#include <iostream>
#include <string>
using namespace std;
int main () {
string str;
int age;
cout << "Please enter age: ";
cin>>age;
cout << "Please enter full name: ";
getline (cin,str);
cout << "Thank you, " << str << ".
";
}
Why function getline() not work when I using uperator >> to input integer ? What is better use for int input ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…