2 Decisions, Decisions

Once you know how to do input, output, and data calculations, you’re on your way to writing real C++ programs. But there’s more to programming than that. The most useful programs have behavior: the ability to respond to conditions.

In effect, computers make decisions. That’s what this chapter is all about.

We’ll start by looking at some simple programs. By the end of the chapter, you’ll have the tools to do something interesting: perform a prime-number test. For large numbers especially, that job is a difficult one for humans, but it’s perfect for a computer.

But First, a Few Words about Data Types

But before you look at computer decision-making, it’s important to understand data. Ultimately, all information on a computer ...

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