Answer:
#include <iostream>
using namespace std;
int main()
{
int grade;
cout << "Enter student's grade: ";
cin >> grade;
switch (grade)
{
case 100 ... 1000:
cout << "That grade is a perfect score. Well done.";
break;
case 90 ... 99:
cout << "That grade is well above average. Excellent work.";
break;
case 80 ... 89:
cout << "That grade is above average. Nice job.";
break;
case 70 ... 79:
cout << "That grade is average work.";
break;
case 60 ... 69:
cout << "That grade is not good, you should seek help!";
break;
default:
cout << "That grade is not passing.";
break;
}
return 0;
}
Step-by-step explanation:
*The code is in C++
First, ask the user to enter a grade
Then, check the grade to print the correct message. Since you need to check the ranges using switch statement, you need to write the minimum value, maximum value and three dots between them. For example, 70 ... 79 corresponds the range between 70 and 79 both inclusive.
Finally, print the appropriate message for each range.
Note: I assumed the maximum grade is 1000, which should more than enough for a maximum grade value, for the first case.