O'Reilly logo

C++ All-in-One For Dummies, 3rd Edition by John Paul Mueller, Jeff Cogswell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4

Directing the Application Flow

In This Chapter

arrow Comparing numbers and evaluating other conditions

arrow Doing things based on a comparison

arrow Repeating code a certain number of times

arrow Repeating code while certain things are true

arrow Repeating code that repeats code that … well, you get the idea

As you program in C++, many times you need to present the computer with a choice, allowing it to do one thing in one situation and something else in another situation. For example, you may have an application that asks for a user’s password. If the password is correct, the application continues; but if the password is incorrect, the application asks the user to reenter the password. After some number of times — usually, three — the application performs yet another task when the user enters the incorrect password. Such situations are called conditions. In the case of the password, the condition is whether the password is correct.

You may also encounter situations where you want several lines of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required