Using Predefined Streams

In addition to giving you the facilities to define your own streams for input and output, the I/O Stream Classes also provide the following predefined streams:

The predefined streams are initialized before the constructors for any static objects are called. You can use the predefined streams in the constructors for static objects.

The predefined streams cin, cerr, and clog are tied to cout. As a result, if you use cin, cerr, or clog, cout is flushed. That is, the contents of cout are sent to their ultimate consumer.

Using the cin Stream in a Class Input Operator