您的位置:首页 > 编程语言 > C语言/C++

C++ Primer 习题3.8

2012-09-29 15:54 162 查看
#include <string>
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::cerr;
int main()
{
int states = 0;
string result = "";
do{
cout<<"Make you choice!"<<endl<<"1 - input a string \n0 - end inputing strings "<<endl;
cin>>states;
if(states == 1){
cout<<"Input your string."<<endl;
cin>>temp;
result += temp;
}else if(states != 0 && states != 1){
cerr<<"error choice!!"<<endl;
}
}while (states != 0);
cout<<"The result of combing all the strings you input is "<<result<<endl;
system("pause");
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: