cin object

In C++ input is handled by using an input stream. An input stream is used to receive data from an input device, usually a keyboard. The input stream is represented by an object called cin. The cin object is part of a library, named iostream. This means that if you wish to use the cin object in a program, then you need to include the library:

#include <iostream>

cin is an object of the iostream class. It is used to accept input from a keyboard. The c is for character and the in is for input. The extraction operator (>>) is used with the cin object to read inputs. The extraction operator extracts data from the cin object, which has been entered via a keyboard.

To use the cin object you need to use the extraction operator, >>, which directs the input into the specified location:

cin >> variable