C++ language

adplus-dvertising
C++ Input/Output
Previous Home Next

In C++ if stream of bytes flow from a keyboard or hard drive to main memory, then this is known as input operation. If bytes flow from main memory to hard drive or display monitor, then this is called output operation.

I/O header files:
Header File Description
<iostream> Provide functionality to perform input and output operations on stream bytes.
<ifstream> Provide functions to read from file.
<ofstream> Provide functions to write on files.
<fstream> Provide functions to read and write from/to files.
<iostream> Provide functionality to perform input and output operations on stream bytes.
Objects
Header File Description
Cin Standard input stream
Cout Standard output stream
Cerr Standard output stream for errors
Clog Standard output stream for logging

in is an object of istream class.

Cout is an object of ostream class.

Cerr is an object of ostream class.

Clog is an object of ostream class.

//   Simple example:
# include <iostream.h>
# include <conio.h>
void main ()
{
   int a,b,c;
   Cout << "Enter two numbers a and b" ;
   Cin >> a >> b ;
   C = a + b ;
   Cout << "Total sum is:" << c ;
}
Previous Home Next