std::cin
and std::cout
are stream objects that refer to standard input and standard output. However, in C++ we also have stream classes for files: std::ifstream
and std::ofstream
. They use exactly the same >>
and <<
functions.
These file stream classes have a member .open()
which can open a new file, provided that you have closed the previous file.