Intro To C++/Reading & Writing Files

library and files
The standard C++ library provides functions for working with files and can be used by adding an #include  directive at the start of the program.The declaration is as follows:

filestream-object object-name("file-name",modes)

The ofstream object is a filestream for writing data to the file and ifstream object is for reading data from the file. The ofstream object is used like the cout function that writes to standard output and the ifstream object works like the cinfunction that reads from standard input.