标签:c语言
/* 思路简单,直接看代码 */ # include <stdio.h> int main(void) { char s1[110],s2[110],s3[220]={' '}; while(scanf("%s %s", s1, s2) != EOF) { getchar(); //吸收回车符。 int i,j,len1,len2; for(i = 0;;i++) { if(s1[i] == '\0') break; } len1 = i; //printf("%d\n", len1); for(j = 0;;j++) { if(s2[j] == '\0') break; } len2 = j; //printf("%d\n", len2); for(i = 0; i < len1+len2; i++) { if(i < len1) { s3[i] = s1[i]; }else { s3[i] = s2[i-len1]; } } printf("%s\n", s3); } return 0; }
标签:c语言
原文地址:http://blog.csdn.net/xu758142858/article/details/44119929