#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;
}
为何结果后面“请按任意键继续”回车后又会有“press any key to continue ”
木柘
相关分类