代码一:
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
char s1[101],s2[101];
int i;
while(cin>>s1>>s2)
{
int n1=strlen(s1);
int n2=strlen(s2);
for(i=0;i<n1;i++)
cout<<s1[i];
for(i=0;i<n2;i++)
cout<<s2[i];
cout<<endl;
}
return 0;
}
代码二:
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
char s1[101],s2[101];
while(cin>>s1>>s2)
{
cout<<strcat(s1,s2)<<endl;
}
return 0;
}
-
题目描述:
-
不用strcat 函数,自己编写一个字符串链接函数MyStrcat(char dstStr[],charsrcStr[])
-
输入:
-
两个字符串,字符串由小写字母组成。
-
输出:
-
链接后的字符串
-
样例输入:
-
hello world good morning
-
样例输出:
-
helloworld goodmorning