C++ Basic Input And Output
We will see that the C++ standard libraries provided us with an extensive set of input/output capabilities. Here we are going to discuss very basic and most common c++ basic input and output operations that are required for c++ basic input and output programming.
C++ basic input and output occur in streams, which generally are nothing but sequences of bytes. When there occurs a situation where bytes flow from a device like a keyboard, a disk drive, or a network connection etc. to main memory, then that can be called input operation and a situation occurs where bytes flow from main memory to a device like a display screen, a printer, a disk drive, or a network connection, etc., then that can be called as output operation.
I/O Library Header Files:-
Below we are going to find header files that are important to C++ programs −
This file generally defines the cin, cout, cerr and clog objects, which are supposed to correspond to the standard input stream, the standard output stream, the un-buffered standard error stream and the buffered standard error stream, respectively.
This file is provided to declare services that are useful for performing formatted I/O with so-called parameterized stream manipulators, such as setw and setprecision.
This file is provided to declare services for user-controlled file processing.
The Standard Output Stream (cout):-
Cout is a predefined object which is an instance of the ostream class. The cout object is generally supposed to be “connected to” the standard output device, which on a common practice is the display screen. The count is always used along with the stream insertion operator, which is written as << which are two less than signs which can be seen in the following example.