16.6 — Arrays and loops

In the introductory lesson for this chapter (), we introduced the scalability challenges that occur when we have many related individual variables. In this lesson, we’ll reintroduce the problem, and then discuss how arrays can help us elegantly solve problems such as these. The variable scalability challenge, revisited Consider the …

11.2 — Arrays (Part II)

Warning This lesson has been deprecated and replaced with the updated lessons in the latter half of chapter 17 (starting with lesson ). This lesson continues the discussion of arrays that began in lesson . Initializing fixed arrays Array elements are treated just like normal variables, and as such, they …

8.11 — Break and continue

Although you have already seen the break statement in the context of switch statements (), it deserves a fuller treatment since it can be used with other types of control flow statements as well. The causes a while loop, do-while loop, for loop, or switch statement to end, with execution …

8.10 — For statements

By far, the most utilized loop statement in C++ is the for-statement. The (also called a ) is preferred when we have an obvious loop variable because it lets us easily and concisely define, initialize, test, and change the value of loop variables. As of C++11, there are two different …