发布网友 发布时间:2022-04-23 19:33
共1个回答
热心网友 时间:2023-09-08 01:33
#include <stdio.h>
#include <string.h>
int main() {
char s[40];
char t[40];
char r[100];
int a = 0;
int lens = 0;
int lent = 0;
scanf("%s", s);
scanf("%s", t);
lens = strlen(s);
lent = strlen(t);
a = strcmp(s, t);
if (a == 0) {
printf("Two strings are equal.\n");
} else if (a > 0) {
strcpy(r, s);
strcpy(r + lens, t);
strcpy(r + lens + lent, "end.");
} else {
strcpy(r, t);
strcpy(r + lent, s);
strcpy(r + lent + lens, "end.");
}
printf("%s\n", r);
return 0;
}