前言
描述
键盘输入两个字符串,将这两个字符串进行拼接后输出。
输入描述:
键盘输入两个字符串
输出描述:
输出两个字符串拼接后的结果
示例1
输入:
hello
nihao
复制
输出:
hellonihao
代码
#include <iostream>
#include <string>
using namespace std;
int main() {
string s1, s2;
getline(cin, s1);
getline(cin, s2);
// write your code here......
cout << s1+s2;
return 0;
}
总结
输入字符串c++用getline,字符串输出可相加