5.10. Wrap-Up

We’ve now completed our introduction to control statements. This chapter demonstrated the for, do...while and switch statements. We showed that any algorithm can be developed using combinations of the sequence structure, the three types of selection statements—if, if...else and switch—and the three types of repetition statements—while, do...while and for. We discussed how you can combine these building blocks. You used the break and continue statements to alter a repetition statement’s flow of control. We also introduced logical operators, which enable you to use more complex conditional expressions in control statements. Finally, we examined the common errors of confusing the equality and assignment operators and provided suggestions ...

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.