In and Out

Most programs need to interact with their users, both to ask them what they want and to present the results when they are available. The computer term for this topic is I/O (short for "input/output"). We'll start by getting information from the keyboard and displaying it on the screen; later, we'll go over the more complex I/O functions that allow us to read and write data on the disk.

The program in Figure 3.20 displays the text "This is a test and so is this.". The meaning of << is suggested by its arrowlike shape: The information on its right is sent to the "output target" on its left. In this case, we're sending the information to one of the predefined destinations, cout, which stands for "character output".[29] Characters sent ...

Get Learning to Program in C++ 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.