Exercises
So that you can test your understanding of this material, here are some exercises.
If the program in Figure 4.19 is run, what will be displayed?
Figure 4.19. Exercise 1 (code\morbas00.cc)
If the program in Figure 4.20 is run, what will be displayed?
Figure 4.20. Exercise 2 (code\morbas01.cc)
Write a program that asks the user to type in a weight, and display the weight on the screen.
Modify the program from exercise 3 to ask the user to type as many weights as desired, stopping as soon as a 0 is entered. Add up all of the weights ...
Get Learning to Program in C++ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.