Chapter 25 Pre-Test, Mid-Test and Post-Test Loop Structures

25.1 The Pre-Test Loop Structure

The pre-test loop structure is shown in the following flowchart.

Image

Let's see what happens when the flow of execution reaches a pre-test loop structure. If Boolean_Expression evaluates to true, the statement or block of statements of the structure is executed and the flow of execution goes back to check Boolean_Expression once more. If Boolean_Expression evaluates to true again, the process repeats. The iterations stop when Boolean_Expression, at some point, evaluates to false and the flow of execution exits the loop.

The Decision symbol (the diamond, or ...

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.