Question: Copy the following text into the file. Debug, compile and run (F11) the program. Does it do what you expect? If not, correct the logic
Copy the following text into the file. Debug, compile and run (F11) the program. Does it do what you expect? If not, correct the logic errors (HINT: use break statements). Compile and run the program several times to test all the conditions.
Style matters!
Indentation (at least 4 spaces) within each block is expected. All statements within a block should be aligned. Use appropriate spacing. (Correct the style for the code below...)
Submit the completed CPP file (not the EXE file) back to this assignment. /* This program illustrates the use of the switch statement. * * COSC-1436 Programming Fundamentals I * Professor Richard Herschede * Place your name here * Place today's date here */ #includeusing namespace std; int main() { //declare variables char grade; //prompt for user inputs cout << "What grade did you earn in Programming I ? "; cin >> grade; //display results switch (grade) // This is where the switch statement begins { case 'A': cout << "an A - excellent work !" << endl; case 'B': cout << "you got a B - good job" << endl; case 'C': cout << "earning a C is satisfactory" << endl; case 'D': cout << "while D is passing, there is a problem" << endl; case 'F': cout << "you failed - better luck next time" << endl; default: cout << "You did not enter an A, B, C, D, or F" << endl; } //end switch return 0; } //end main()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
