64 689
Assignments Done
99,3%
Successfully Done
In September 2018

Answer to Question #1603 in C++ for idaira

Question #1603
Write a C++ program that prompts the user to enter the marks of a test. This program should have a user-defined function named grade(), that takes in the marks and returns the grade obtained to the main() function to be displayed. The grading scale is as shown below:

Marks
Grade
80 to 100
A
60 to 79
B
40 to 59
C
0 to 39
F
Expert's answer
#include
#include

using namespace std;

int mark;

int main()
{
system("cls");
cout << "Enter mark: " << ends;
cin >> mark;
if(mark >= 0 && mark <= 39) cout << "Grade: F";
if(mark >= 40 && mark <= 59) cout << "Grade: C";
if(mark >= 60 && mark <= 79) cout << "Grade: B";
if(mark >= 80 && mark <=100) cout << "Grade: A";

getch();
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions