为什么getline输入时,我要敲两次回车才行????
#include<iostream>
#include<string>
using namespace std;
int main()
{
string name;
cout<<"Input your name: ";
getline(cin, name);
if(name.empty())
{
cout<<"input is null...."<<endl;
return 0;
}
if(name == "imooc")
{
cout<<"you are a administrator"<<endl;
}
cout<<"hello "<<name<<endl;
cout<<"name's length: "<<name.size()<<endl;
cout<<"首字母: "<<name[0]<<endl;
return 0;
}