O'Reilly logo

C++ Without Fear: A Beginner’s Guide That Makes You Feel Smart, Second 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

Once you know how to do input, output, and data calculations, you’re on your way to writing real programs. But the most useful programs have behavior: the ability to respond to conditions.

Although they don’t have human judgment, computers do make simple decisions. That’s what this chapter is about. We’ll start by looking at short programs. By the end of the chapter, you’ll have the tools to write a complete game program!

But First, a Few Words about Data Types

You might think of a variable as a magic box or a bucket to hold data. But it can hold only so much information—information being a precious commodity. It’s not infinite.

Chapter 1 developed examples using floating-point data. This chapter uses integer data, which ...

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