#include<iostream>
#include<string>
#include<cstring>
int main()
{
using namespace std;
string a,b;
cout<<"Enter your name: \n";
getline(cin,a);
cout<<"Enter your favorite dessert:\n";
cin.get();
getline(cin,b);
cout<<"I have some delicious "<<b<<" for you "<<a<<endl;;
return 0;
}
我用这个getline(cin,a)的时候似乎都要输两次回车啊,到底是什么原因啊,谁能解释下,谢了哈