In: Computer Science
Please use a switch statement to tell the user that his work is great, good, satisfactory, or he barley passed based on his grade (A : great work, B : good, C: satisfactory, D: Barley passed) This program must be in C++ and must be able to run.
Thank you and I hope you have a great day!
#include<iostream>
using namespace std;
int main()
{
char grade;
cout<<" A,B,C,D enter you grade from this
options"<<endl;
scanf("%c",&grade);
switch(grade) //grade contains input from user switch
statment matches that input with given cases, case which is match
is gegts executed
{
case 'A': cout<<"great
work"<<endl;
break;
case 'B':cout<<"good
"<<endl;
break;
case
'C':cout<<"Satisfactory"<<endl;
break;
case 'D':cout<<"Barley
passed"<<endl;
break;
default:
cout<<"please enter correct grade";//if grade is other than
A,B,C,D
break;
}
return 0;
}