(Practice) Rewrite the following if-else chain by using a switch statement:
Program:
if (letterGrade == 'A')cout << “The numerical grade is between 90 and 100\n”;else if (letterGrade == 'B')cout << “The numerical grade is between 80 and 89.9\n”;else if (letterGrade == 'C')cout << “The numerical grade is between 70 and 79.9\n”;else if (letterGrade == 'D')cout << “How are you going to explain this one?\n”;else{cout << “Of course I had nothing to do with my grade.\n”;cout << “It must have been the professor’s fault.\n”;}
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.