Site icon

C++ Input Statement


In this tutorial, we will learn the C++ input statement with the help of a sample program. The basic input object to take input from the standard input device is the cin object

C++ Input Statement

We use the cin input object and the >> operator to take the input from the standard device. The C++ standard input device is the keyboard.

For example, to take input to an integer variable called num, we can use the following statement

cin >> num; 

C++ Program

We will write a simple C++ program to understand the concept. We will write a simple program to read an integer value from the standard input device i.e keyboard, store the value in a variable and display the value to the computer screen.


* C++ Input
* Filename: input.cpp
* Program to take user input from standard
* input device.
* C++ Tutorials -
using namespace std;
int main()
    int num; //declare integer variable
    cout << "Enter integer input:"; // User prompt cin >> num; // C++ Input Statement
    cout << "The value is =:" << num << endl;

    return 0;
} // end main

Sample Output

Enter integer input:79
The value is =:79

C++ Tutorials

C++ Tutorials on this website:

For more information on the current ISO C++ standard

Exit mobile version