Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify this C++ program to use if/else if/else statements instead of a switch statement Remember Indentation (at least 4 spaces) within each block is expected.

Modify this C++ program to use if/else if/else statements instead of a switch statement Remember Indentation (at least 4 spaces) within each block is expected. All statements within a block should be aligned. Use appropriate spacing. #include using 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

what is the meaning of TWA ?

Answered: 1 week ago