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 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.