Chapter 6. BRANCHING STATEMENTS AND LOGICAL OPERATORS

You will learn about the following in this chapter:

  • The if statement

  • The if else statement

  • Logical operators: &&, ||, and !

  • The cctype library of character functions

  • The conditional operator: ?:

  • The switch statement

  • The continue and break statements

  • Number-reading loops

One of the keys to designing intelligent programs is to give them the ability to make decisions. Chapter 5, "Loops and Relational Expressions," shows you one kind of decision making—looping—in which a program decides whether or not to continue looping. Now you investigate how C++ lets you use branching statements to decide among alternative actions. Which vampire-protection scheme (garlic or cross) should the program use? What menu ...

Get The Waite Group's C++ Primer Plus, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.