Day 17. Working with Streams

Until now, you’ve been using cout to write to the screen and cin to read from the keyboard, without a full understanding of how they work. Today, you will learn all about both of these.

Today, you will also learn

• What streams are and how they are used

• How to manage input and output using streams

• How to write to and read from files using streams

Overview of Streams

C++ does not define how data is written to the screen or to a file, nor how data is read into a program. These are clearly essential parts of working with C++, however, and the standard C++ library includes the iostream library, which facilitates input and output (I/O).

The advantage of having the input and output kept apart from the language and ...

Get Sams Teach Yourself C++ in 21 Days , Fifth 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.