Chapter 2. Setting Out to C++

In this chapter you’ll learn about the following:

• How to create a C++ program

• The general format for a C++ program

• The #include directive

• The main() function

• How to use the cout object for output

• How to place comments in a C++ program

• How and when to use endl

• How to declare and use variables

• How to use the cin object for input

• How to define and use simple functions

When you construct a simple home, you begin with the foundation and the framework. If you don’t have a solid structure from the beginning, you’ll have trouble later filling in the details, such as windows, door frames, observatory domes, and parquet ballrooms. Similarly, when you learn a computer language, you should begin by learning ...

Get C++ Primer Plus, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.