string初始化
阿新 • • 發佈:2018-10-01
sin letter nis esp names out lan sys spa
#include<iostream>
#include<string>
using namespace std;
int main(){
string name;
cout<<"Please input your name:"<<endl;
getline(cin,name);
if(name.empty()){
cout<<"input is null.."<<endl;
system("pause");
return 0;
}
if(name=="imooc"){
cout<<"you are a administrate"<<endl;
}
cout<<"hello"+name<<endl;
cout<<"your name length"<<name.size()<<endl;
cout<<"your name first letter is:"<<name[0]<<endl;
system("pause");
return 0;
}
string初始化