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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!