Lesson 10: Nested Loops

[spoiler title=”Lesson Video”]
Direct Download of Video (For mobile / offline viewing)(right click > save target as)


[/spoiler]

[spoiler title=”Lesson Source Code”]

[/spoiler]

Homework: http://beginnerscpp.com/forums/index.php/topic,63.0.html



Nested Loops
In this lesson I threw you guys straight into the deep end. The basic concept of nested loops is the same as a nested if statement, you have an inner loop that will complete all of it’s instructions every time through the outer loop (unless there is a break statement somewhere). Here’s an example:

As you can see in the example, the inner loop is running fully every time the outer loop iterates.