In this program, you will learn, how to print the number entered by a user using C++ cout statement. The program will ask to enter a number from the user and display that number on the screen.
Example: Print Number Entered by the User
using namespace std;
cout << "Enter an integer: ";
cin >> number;
cout << "You entered " << number;
When you run the program, the output will be following:
Enter an integer: 12
You entered 12
This program asks the user to enter a number.
When the user enters an integer, it is stored in the variable number using cin.
Then it is displayed on the screen using cout.