5.14 Wrap-Up

In this chapter, we completed our introduction to control statements, which enable you to control the flow of execution in member functions. Chapter 4 discussed if, ifelse and while. This chapter demonstrated for, dowhile and switch. We discussed the representational errors associated with floating-point types, then developed a DollarAmount class that used very large integers to precisely represent monetary amounts. We used only precise integer arithmetic when manipulating DollarAmounts. We showed that any algorithm can be developed using combinations of the sequence structure, the three types of selection statements—if, ifelse and switch—and the three types of iteration statements—while, dowhile and for. In this chapter and ...

Get C++ How to Program, 10/e 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.