首页 > 其他 > 详细

演示使用string对象

时间:2016-03-12 01:35:29      阅读:168      评论:0      收藏:0      [点我收藏+]
#include<iostream>
#include<string>

using namespace std;
void main()
{
    string str1("i am here!");
    string str2="where are you?";
    cout << str1[0] << str1[9] << "," << str1 << endl;
    cout << str2[0] << str2[13] << "," << str2 << endl;
    cout << "please input you name:";
    cin >> str1;
    cout << str1 << endl;
    cout << "length of the name is :" << str1.size() << endl;
    cout << str2 + " " + str1 << endl;
}

输出结果

技术分享

 

end!

演示使用string对象

原文:http://www.cnblogs.com/changbo/p/5267762.html

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