Question: 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

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 Databases Questions!