Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Add a do-while loop to complete the program. The do-while loop will make sure that a valid mark will be obtained before further process. (hint:

Add a do-while loop to complete the program. The do-while loop will make sure that a valid mark will be obtained before further process. (hint: a event-controlled do-while loop is needed.)

Compile and run the program. Use input values: -10, 30, 59, 70, 75, 96, and 108.

Get a copy of the loopDW.cpp.

/************************************************************ * * FileName: loopDW.cpp * Purpose: Demonstrate how to use Do-while Statement. * **************************************************************/ #include using namespace std; int main() { int mark; char grade; cout << "Please enter an integer mark: " << endl; // Please add a do-while loop below to make sure a valid mark // between [0, 100] is entered. if (mark >= 85) { grade = 'A'; cout << "Great Mark. " << endl; } else if (mark >= 75 && mark < 85) { grade = 'B'; cout << "Good Mark. " << endl; } else if (mark >= 65 && mark < 75) { grade = 'C'; cout << "Average Mark. " << endl; } else if (mark >= 50 && mark < 65) { grade = 'D'; cout << "You passed the class. " << endl; } else { grade = 'F'; cout << "You failed the class. " << endl; } cout << "The corresponding character grade is " << grade << endl; return 0; } // end program -------------------------------------------

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

Beginning VB.NET Databases

Authors: Thearon Willis

1st Edition

1594864217, 978-1594864216

More Books

Students also viewed these Databases questions

Question

Question What are the requirements for a SIMPLE 401(k) plan?

Answered: 1 week ago