Chapter 4. Control Structures

A control structure determines what the program does next: make decisions, perform actions conditionally, and—critical to nearly all computing—loop. By looping, you direct the program to carry out repetitive actions efficiently, instead of being repetitive yourself.

This chapter begins with a concise guide to the grammar of C++ statements and then describes each control structure in detail. Finally it presents exception handling, a special kind of decision making that responds to exceptional situations at runtime. (Hence the name.)

4.1. Concise Summary of C++ Statements

The key to C++ statement syntax is that it’s recursive: Each of the items described in this section is a statement; therefore, each of them can ...

Get C++ for the Impatient now with O’Reilly online learning.

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