C++ Program to Get Input from User

« Previous Program Next Program »

Get Input from User in C++

To receive or get/take input from the user, use cin>>input.

Here, input is the entered number, character, name, etc.

The cin>> is used to receive the input data like integer, character, float, etc.

C++ Programming Code to Get Input from User

Following C++ program ask to the user to enter a number, then display the entered number on the screen:

/* C++ Program - Get Input from User */
void main()
	int num;
	cout<<"Enter a number : ";
	cout<<"You entered "<<num;

When the above C++ program is compile and executed, it will produce the following result:

receiving input in C++ Programming

Same Program in Other Language

You may like the same program in other programming languages:

« Previous Program Next Program »


Quick Links
Signup - Login - Give Online Test