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 O’Reilly online learning.

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