Next: The for statement Up: The do-while statement Previous: Review Questions

Exercises

  1. Rewrite the program that you produced for exercise 1 in Lesson 16 using a do-while statement rather than a while statement.

  2. Rewrite the program that you produced for exercise 2 in Lesson 16 using a do-while statement rather than a while statement.

  3. Write a C++ program to implement the following requirement:
    A set of examination marks expressed as percentages are to be processed by computer. Data entry is terminated by entering a negative percentage value. As each examination mark is entered it should be validated as being either a valid percentage or as being a negative number. The program should ask for the data entry to be repeated until a valid value is entered. The program should then output the number of percentage marks entered, the average mark and how many marks were above 40
    The program should implement the loop by using a do-while loop.



Next: The for statement Up: The do-while statement Previous: Review Questions