通过字符串函数连接两个字符数组:
#include "stdafx.h"
#include
using namespace std;
void main()
{
char str1[50], str2[30], *p1, *p2;
p1 = str1;
p2 = str2;
cout << "please input string1:" << endl;
gets_s(str1);
cout << "please input string2:" << endl;
gets_s(str2);
strcat_s(str1, str2);//对字符串也行,对数组也行
cout << "the new string is:" << endl;
puts(str1);
}Long Long
421***914@qq.com
参考地址
6年前 (2019-08-08)