为何输入姓名后要按两下回车才有结果
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
int main()
{
string name;
cout<<"请输入姓名:";
getline(cin,name);
if(name.empty())
{
cout<<"输入为空"<<endl;
system("pause");
return 0;
}
if(name == "imooc")
{
cout<<"you are a administrator"<<endl;
}
cout<<"hello "+ name<<endl;
cout<<"名字首字母是:"<<name[0]<<endl;
cout<<"名字的长度是:"<<name.size()<<endl;
system("pause");
return 0;
}