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