C++ Program to Print Number Entered by User

In this example, you'll learn to print the number entered by a user using C++ cout statement.

Example: Print Number Entered by User

#include <iostream>
using namespace std;

int main()
{    
    int number;

    cout << "Enter an integer: ";
    cin >> number;

    cout << "You entered " << number;    
    return 0;
}
Output
Enter an integer: 23
You entered 23
This program asks user to enter a number.
When user enters an integer, it is stored in variable number using cin.
Then it is displayed in the screen using cout. Read More C++

Comments

Popular posts from this blog

Creating a Cursor from a Font Symbol in a WPF Application

C++ Program to Find All Roots of a Quadratic Equation

C++ Program to Find Quotient and Remainder