Learning objectives for chapter 7
Learn to use else-if logic to select from among several sets of statements depending on conditions being met.
Learn to use switch-statements that test cases of int variables and char variables.
Learn the difference between event-controlled and count-controlled loops, and how to implement each.
Learn how to implement for-loops.
Learn what are nested loops and how to manage them in a program.
Learn how to reverse logic by applying DeMorgan's Theorem.
  Learning objective(s) addressed
  123456
Exercises Right-click (or control-click on a Mac) the title to save its PDF to your system.  
7.1 Using Switch-statements PDF  X    
7.2 Input Validation PDF   XX  
7.3 Making Change While PDF   XX  
7.4 Coin Toss, v.2.0 PDF   XX  
7.5 Coin Toss, v.3.0 PDF   XXX 
7.6 The Game Of War, v.2.0 PDF X X   
7.7 The Game Of War, v.3.0 PDF X X X 
7.8 The Rock-Scissors-Paper Game, v.1.0 PDF X X X 

 
Samples Right-click (or control-click on a Mac) the title to save its PDF to your system.  
7.1 About For-loops PDF    X  
7.2 About Nested Loops PDF     X 
7.3 About DeMorgan's Theorem PDF      X

 
Videos  
7.1 Click HERE for a YouTube-like video that shows how to develop code with loops. It's 20 minutes long, using C++ with the JNotePad editor and the Visual Studio command line compiler, on a Windows PC. It demonstrates the development of a program that uses an event-controlled, while-true-if-break loop, with else-if logic. X X   
7.2 Click HERE for a YouTube-like video that shows how to develop the MasterMind game "from scratch". View the video to see how a problem similar to Rock-Paper-Scissors is developed. It's 70 minutes long, using C++ with the JNotePad editor and the g++ XCode command-line compiler on a Mac. It demonstrates the development of a program that uses an event-controlled, while-true-if-break loop, with else-if logic. X X   

Code from the chapter in order of their appearance in the text
grades.cpp compare2Numbers.cpp gradeSwitch.cpp bounce.cpp thereYet2.cpp bounce2.cpp
countFromZero.cpp backwards.cpp rightTriangle.cpp pyramid.cpp diamond.cpp digitalClock.cpp
redGreen.cpp redGreen2.cpp        

Chapter 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15