Answer to Question #292392 in C++ for Muskan

Question #292392

Write a program that accepts a letter grade as input and outputs the teacher’s remarks. Use



only switch, do not use any if’s. Example: If ‘A’or ‘a’, then “Excellent job!”. If ‘F’ or ‘f’, then “You



failed. Please study more next time”.

1
Expert's answer
2022-02-01T04:12:12-0500
#include<iostream>

using namespace std;




int main()

{

char grade;

cin >> grade;

switch (grade)

{

case 'A':

case 'a':

cout << "Excellent job!";

break;

case 'B':

case 'b':

cout << "Well!";

break;

case 'C':

case 'c':

cout << "Not bad!";

break;

case 'D':

case 'd':

cout << "You can do better!";

break;

case 'E':

case 'e':

cout << "Terrible!";

break;

case 'F':

case 'f':

cout << "You failed. Please study more next time";

break;

default:

cout << "Error";

break;

}

cout << endl;

system("pause");

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 the first!

Leave a comment

LATEST TUTORIALS
New on Blog