You are on page 1of 1

CIN / COUT in C++

In C++, cin and cout are objects that are used for handling input and output
operations, respectively.

• cin is an object of the istream class, which is used to read input from the
user. It accepts input from a standard input device, such as a keyboard, and
is linked to stdin, the regular C input source. It is typically used with the
extraction operator >>.
• cout is an object of the ostream class, which is used to perform output
operations. It is used to display the output to the screen, i.e., the standard
output device stdout. It is typically used with the insertion operator <<.

These are part of the C++ Standard Library, specifically the iostream library,
which stands for input/output stream. It provides a convenient unformatted way to
perform input and output operations in C++.

#include <iostream>
using namespace std;

int x;

int main(void)
{
cin >> x;
cout << x * x << endl;
cout << "End of the program" << endl;
return 0;
}

You might also like