📜  用户输入 c++ 代码示例

📅  最后修改于: 2022-03-11 14:44:51.686000             🧑  作者: Mango

代码示例2
int x; 
cout << "hurry, give me a number!: "; // Type a number and press enter
cin >> x; // Get user input from the keyboard
cout << "you picked: " << x << " !" // Display the input value

OR use:
getline >> (cin, variable-name);
instead of 
cin >> x;