求助大神们!
求助 为什么我输入完名字后 第一次按回车 出现一行空格 再按一次才显示hello 以及其他的信息
求助 为什么我输入完名字后 第一次按回车 出现一行空格 再按一次才显示hello 以及其他的信息
2016-11-05
#include<iostream>
#include<stdlib.h>
#include<string>
using namespace std;
int main()
{
string name;
cout << "Please enter 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<< "your name length :"<< name.size() <<endl;
cout<< "your name first letter is:"<< name[0] <<endl;
return 0;
}举报