5. Control Statements: Part 2; Logical Operators

Who can control his fate?

—William Shakespeare

The used key is always bright.

—Benjamin Franklin

Objectives

In this chapter you’ll learn:

• The essentials of counter-controlled repetition.

• To use for and do...while to execute statements in a program repeatedly.

• To implement multiple selection using the switch selection statement.

• How break and continue alter the flow of control.

• To use the logical operators to form complex conditional expressions in control statements.

• To avoid the consequences of confusing the equality and assignment operators.

Get C++ How to Program, Ninth Edition 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.