Exercice_3.8

//连接多个string对象
#include <iostream>
#include <string>
using namespace std;

int main()
{
    string str,result_str;

    //读入多个string对象并进行连接
    cout<<"Enter strings(Ctrl+Z to end):"<<endl;
    while(cin>>str)
        result_str=result_str+' '+str;

    //输出连接后的对象
    cout<<"Concatenations of these strings is "<<result_str<<endl;
    return 0;
}

posted @ 2014-05-04 23:23  庄浩  阅读(136)  评论(0编辑  收藏  举报