Chapter 1. What Is a Program?

In This Chapter

  • Understanding programs

  • Writing your first "program"

  • Looking at computer languages

In this chapter, you will learn what a program is and what it means to write a program. You'll practice on a Human Computer. You'll then see some program snippets written for a real computer. Finally, you'll see your first code snippet written in C++.

Up until now all of the programs running on your computer were written by someone else. Very soon now, that won't be true anymore. You will be joining the ranks of the few, the proud: the programmers.

How Does My Son Differ from a Computer?

A computer is an amazingly fast but incredibly stupid machine. A computer can do anything you tell it (within reason), but it does exactly what it's told — nothing more and nothing less.

In this respect, a computer is almost the exact opposite of a human: humans respond intuitively. When I was learning a second language, I learned that it wasn't enough to understand what was being said — it's just as important and considerably more difficult to understand what was left unsaid. This is information that the speaker shares with the listener through common experience or education — things that don't need to be said.

For example, I say things to my son like, "Wash the dishes" (for all the good it does me). This seems like clear enough instructions, but the vast majority of the information contained in that sentence is implied and unspoken.

Let's assume that my son knows what dishes are ...

Get Beginning Programming with C++ For Dummies® 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.