1// i/o example
2
3#include <iostream>
4using namespace std;
5
6int main ()
7{
8 int i;
9 cout << "Please enter an integer value: ";
10 cin >> i;
11 cout << "The value you entered is " << i;
12 return 0;
13}
1int x;
2cout << "hurry, give me a number!: "; // Type a number and press enter
3cin >> x; // Get user input from the keyboard
4cout << "you picked: " << x << " !" // Display the input value
5
6OR use:
7getline >> (cin, variable-name);
8instead of
9cin >> x;
10