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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.