首页 > 其他 > 详细

string初始化

时间:2018-10-01 14:26:28      阅读:174      评论:0      收藏:0      [点我收藏+]

#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初始化

原文:https://www.cnblogs.com/huoyuying/p/9734606.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!