Commentary: Control Flow

Steven Zeil

Last modified: Aug 31, 2017
Contents:

What distinguishes computers from simple calculators? The ability to organize calculations by making decisions about what calculations to perform and to some calculations over and over.

Read chapters 4 & 5, Control Structures, of Malik, if you have not already done so. (If you are working from a different C++ textbook, you will have to figure out the corresponding chapters.)

1 Conditionals and Loops

The concepts here should be very familiar to you. You should already know

  1. what loops and conditional statements are and how they perform in a running program,
  2. what kinds of things we use loops and conditional statement for.

If those kinds of ideas cause you to struggle, you should probably go back and review them, in your original programming language, write some sample programs involving them, until you are more comfortable with the ideas.

That really leaves just the syntax or appearance of these statements in C++ to worry about.

If you are a C programmer
If you are a Java programmer
If you are a Python programmer