//连接多个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;
}
Exercice_3.8
最新推荐文章于 2014-05-20 23:01:24 发布