Question: / / This program illustrates the use of the switch statement. #include using namespace std; int main ( ) { char grade; cout < <

// This program illustrates the use of the switch statement.
#include
using namespace std;
int main()
{
char grade;
cout << "What grade did you earn in Programming I ?"<< endl;
cin >> grade;
float grade // This is where the if/else if statement begins
if ( grade = A)
cout <<"an A - excellent work !"<< endl;
else if ( grade = B)
cout << "you got a B - good job" << endl;
else if ( grade = C)
cout << "earning a C is satisfactory" << endl;
else if ( grade = D)
cout << "while D is passing, there is a problem" << endl;
else if ( grade = F)
cout << "you failed - better luck next time" << endl;
else
cout << "You did not enter an A, B, C, D, or F"<< endl;
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!