- 新增现代 C++ 教程的 Preface 章节,包括英文和中文版本 - 添加 C++ Primer 练习代码 - 新增 Learn C++ 教程的 C++ 开发简介章节 - 添加头文件解析文档 - 更新 mkdocs.yml,包含新教程的目录结构 - 修改项目设置,使用 Python 3.10环境
28 lines
586 B
C++
28 lines
586 B
C++
#include <iostream>
|
|
#include <string>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
char cont = 'y';
|
|
string s, result;
|
|
cout << "请输入字符串" << endl;
|
|
while(cin >> s) {
|
|
if (!result.size())
|
|
result += s;
|
|
else
|
|
result = result + " " + s;
|
|
cout << "是否继续(y or n)" << endl;
|
|
cin >> cont;
|
|
if (cont == 'y' || cont == 'Y'){
|
|
cout << "请输入下一个字符串" << endl;
|
|
}else {
|
|
break;
|
|
}
|
|
}
|
|
cout << "拼接后的字符为" <<result << endl;
|
|
|
|
|
|
return 0;
|
|
}
|