Sequence Structure in C++

The sequence structure is built into C++. Unless directed otherwise, the computer executes C++ statements one after the other in the order in which they’re written—that is, in sequence. The UML activity diagram of Fig. 4.1 illustrates a typical sequence structure in which two calculations are performed in order. C++ allows you to have as many actions as you want in a sequence structure. As you’ll soon see, anywhere a single action may be placed, you may place several actions in sequence.

Image

Fig. 4.1. Sequence-structure activity diagram.

In this figure, the two statements add a grade to a total variable and add the value ...

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.