Question
using C++ Give valid C++ statement for each of the following (make sure to put semicolon to the end if you need that, your statement
using C++ Give valid C++ statement for each of the following (make sure to put semicolon to the end if you need that, your statement should be accurate one). (2 x 5 = 10 points) a) Declare and initialize a variable called year to store the current year (2021)
b) Write an assignment statement to compute the following expression. phi=(x+5)/(2*x-3) Assume that x is already declared as float and its value is also provided. You need to declare phi and then write the expression to find the value of phi.
c) Given in a problem that a students score is valid only if the value of the score is between 0 and 100, write a selection statement in c++, to write this logic, so that if the score is between this range, the program will display, it is a valid score, otherwise it will display it is an invalid score. (Assume score is an integer variable and it is declared and known)
d) Write valid statements to open an input datafile called data.txt.
e) Declare a function named Mortgage that takes the following as input parameters: loan ( a float), years (an int) and rate (a float) and the function returns a float. You need to declare only.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started