In C++ programing language, all header files end with .H extension. In standard C++, all devices are accessed and used as a file.
One such header file is iostream.h in C++ programming language. In this, all input and output devices are treated as files.
Let's quickly look at what are the input and output devices mean in C++ program.
Standard Input Device
- Keyboard
Standard Output Device
- Monitor
Standard Error Device
- Screen or monitor
In C++, input and output are not defined within, and are implemented with the help of a component of the C++ standard library which is I/O library.
A file is read simply as a stream of bytes at the lowest level. But at a user level, a file consists of possibly mixed data types which can be characters, arithmetic values class, objects etc.
What are the predefined streams in I/O Library?
As discussed above there are input, output and error library in c++, they have some predefined streams objects as well which are used in the code. Let's have a look at them.
Standard Input - For standard input in c++, cin is defined as istream class object. cin stands for console input.
Standard output - For standard output in c++, cout is defined as ostream class object.
Standard Error - For standard error in c++, cerr is defined as ostream class object.
The declarations and functions of all three - cin, cout, and cerr are contained within the iostream.h header file.