C++ Basic Input Output
C++ Basic Input Output
C++ I/O operation is using the stream concept. Stream is the sequence of bytes or flow of data. It
makes the performance fast.
If bytes flow from main memory to device like printer, display screen, or a network connection, etc,
this is called as output operation.
If bytes flow from device like printer, display screen, or a network connection, etc to main memory,
this is called as input operation.
Header
Function and Description
File
It is used to define the cout, cin and cerr objects, which correspond to standard output
<iostream>
stream, standard input stream and standard error stream, respectively.
It is used to declare services useful for performing formatted I/O, such as setprecision
<iomanip>
and setw.
<fstream> It is used to declare services for user-controlled file processing.
Example of a programming
#include <iostream>
using namespace std;
int main() {
char name[50];
cout << "Please enter your name: ";
cin >> name;
cout << "Your name is: " << name << endl;