Chapter 21. Statements and Control Structures

Programs consist of statements of various kinds. Control structures are statements that control the way other statements are executed. This chapter formally defines the language elements and shows what kind of control structures are available.

21.1

Statements

480

21.2

Selection Statements

480

21.3

Iteration

483

21.4

Exceptions

485

Statements

A C++ program contains statements that alter the state of the storage managed by the program and determine the flow of program execution. There are several types of C++ statements, most of which are inherited from the C language. First, there is the simple statement, terminated with a semicolon, such as

x = y + z;

Next, there is the compound statement, or block, consisting of ...

Get An Introduction to Design Patterns in C++ with Qt 4 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.