A stream is a sequence of data objects. In the context of file
input and output, cout
is the name of a stream that flows from
your program to your screen, and cin
is the name of a stream
that flows from your keyboard to your program.
cin stream cout stream Keyboard ---------------> Your program ---------------> Screen
To read data from a file, you create an input stream that flows from an input file to your program. Similarly, to write data into a file, you create an output stream that flows from your program to the output file.