The <iostream> Library

Input/output (I/O) in C++ relies on overloading the operators << (for writing) and >> (for reading). All output classes derive from ostream, so overloading the >> operator for ostream means that you can use that operator for any output class. It is important to realize that file output is buffered; that is, the data is not immediately written to the actual disk file. This is done to speed up I/O because disk access occurs much more slowly than memory access. You can flush file streams (that is, write them to disk) by using the ostream::flush() method when the streams are closed. This is why it is important that file streams are closed properly.

The standard streams are cin, cout, and cerr. (cerr is used for error output. ...

Get C++ By Example: UnderC Learning 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.