Chapter 4. Control Statements, Part 2

Images

Objectives

In this chapter, you’ll:

Use the for and dowhile iteration statements.

Perform multiple selection using the switch selection statement.

Use C++17’s [[fallthrough]] attribute in switch statements.

Use C++17’s selection statements with initializers.

Use the break and continue statements to alter the flow of control.

Use the logical operators to form compound conditions in control statements.

Understand the representational errors associated with using floating-point data to hold monetary values.

Use C++20’s [[likely]] and [[unlikely]] attributes to help the compiler optimize selection ...

Get C++20 for Programmers, 3rd Edition now with the O’Reilly learning platform.

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