C++ Program to Print Number Entered by User

Example: Print Number Entered by User

  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int number;
  6. cout << "Enter an integer: ";
  7. cin >> number;
  8. cout << "You entered " << number;
  9. return 0;
  10. }
Output
Enter an integer: 23
You entered 23
This program asks user to enter a number.
Then it is displayed in the screen using cout

Comments

Popular posts from this blog

C++ Templates ?

Educational Website