O'Reilly logo

C++ Without Fear: A Beginner’s Guide That Makes You Feel Smart, Third Edition by Brian Overland

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

2. Decisions, Decisions

If you’ve worked through Chapter 1, you’ve already begun to do real programming: getting input, crunching numbers, and printing output. But to really do anything interesting, you have to give the program the ability to make decisions. IF this, THEN do that, and so on.

Computers don’t really make the decisions the way humans do (not without Artificial Intelligence, a topic I discuss on page 31). Like everything else in a program, decisions must be absolutely clear and precise, and depend on the result of comparing two numbers. And yet, upon such simple decisions, it’s possible to build complex, interesting, and rich behavior.

But First, a Few Words about Data Types

You can think of a variable as a magic box or a bucket ...

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