In this chapter, we present C++’s remaining control statements. The control statements we study here and those you learned in Chapter 4 will help you build and manipulate objects. We continue our early emphasis on object-oriented programming.
In this chapter, we demonstrate the
switch statements. Through examples using
for, we explore counter-controlled repetition. We expand the
GradeBook class to use a
switch statement to count the number of A, B, C, D and F grades in a set of letter grades entered by the user. We introduce the
continue program control statements. We discuss the logical operators, which enable you to use more powerful conditional expressions. We also examine the common ...