Chapter 20 Nested Decision Control Structures

20.1 What are Nested Decision Control Structures?

Nested decision control structures are decision control structures that are “nested” (enclosed) within another decision control structure. This means that one decision control structure can nest (enclose) another decision control structure (which then becomes the “nested” decision control structure). In turn, that nested decision control structure can enclose another decision structure, and so on.

An example of a nested decision control structure is shown here.

Image

This can be rearranged to become

and the C++ code is shown here.

if (x < 30) {
if (x < ...

Get C++ and Algorithmic Thinking for the Complete Beginner 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.