Write a COMPLETE C program to ask the user to enter a grade

Write a COMPLETE C++ program to ask the user to enter a grade. If the grade is greater than or equal to 60, but less than or equal to 100, the program will display \"Congratulation! You passed the exam.\" If the grade is less than 60, hut greater than or equal to 0, the program will display \"You failed the test, Work harder.\" If the grade is not within the range from 0 to 100, the program will display \"Invalid grade.\" The following is a sample running result: Running example 1: Please enter your grade. 89 Congratulation! You passed the exam. Press any key to continue..... Running example 2: Please enter your grade: 55 You failed the test. Work harder. Press any key to continue..... Running example 3: Please enter your grade: 105 Invalid grade. Press any key to continue....

Solution

#include <iostream>
using namespace std;

int main(void)
{
int mark;

cout<<\"Enter student\'s mark: \";
cin>>mark;
if (mark < 40)
cout<<\"Student grade = F\";
else if (mark < 50)
cout<<\"Student grade = E\";
else if (mark < 60)
cout<<\"Student grade = D\";
else if (mark < 70)
cout<<\"Student grade = C\";
else if (mark < 80)
cout<<\"Student grade = B\";
else
cout<<\"Student grade = A\";
cout<<\"\ \";

return 0;
}

 Write a COMPLETE C++ program to ask the user to enter a grade. If the grade is greater than or equal to 60, but less than or equal to 100, the program will dis

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site