The cout Statement, Word by Word

The cout statement is what actually displays the program result on the screen or window. It is a special object from the iostream library.

The << symbol (two less-than signs) is an inserter, which takes whatever follows it and gives it to the cout object. Here you can see a little hint of what object-oriented programming is like.

What follows the inserter is a literal (as in “take this literally”). In this case, it is a string literal—a string of characters that consists of everything between the quotation marks.

The second inserter tacks an “end of line” (endl) on the end of the string literal display so that if anything further is displayed it will start on its own line. Different operating systems use different ...

Get SAMS Teach Yourself C++ in 10 Minutes SECOND 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.