题目描述
写一函数,将两个字符串连接
输入格式
两行字符串
输出格式
链接后的字符串
样例输入
123
abc
样例输出
123abc
解题思路
因为使用的是C++,运用string类内置函数库中的append函数可以直接进行字符串拼接
C++字符串操作集锦在这篇博客中有详细解释,可以自行阅读学习
//https://blog.csdn.net/liuweiyuxiang/article/details/83687452
解题代码
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main()
{
string string1,string2;
cin>>string1>>string2;
string1.append(string2);
cout<<string1<<endl;
return 0;
}