Contents

Section 1.1 Writing a Simple C++ Program

Section 1.2 A First Look at Input/Output

Section 1.3 A Word about Comments

Section 1.4 Flow of Control

Section 1.5 Introducing Classes

Section 1.6 The Bookstore Program

Chapter Summary

Defined Terms

This chapter introduces most of the basic elements of C++: types, variables, expressions, statements, and functions. Along the way, we’ll briefly explain how to compile and execute a program.

After having read this chapter and worked through the exercises, you should be able to write, compile, and execute simple programs. Later chapters will assume that you can use the features introduced in this chapter, and will explain these features in more detail.

The way to learn a new programming language is ...

Get C++ Primer, Fifth 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.