提交记录 #193
提交时间:2024-11-12 18:48:12
语言:c
状态:Unaccepted
编译情况:编译成功
code.c: In function ‘main’:
code.c:31:13: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[100]’ [-Wformat=]
31 | scanf("%s%s", &str1, &str2);
| ~^ ~~~~~
| | |
| | char (*)[100]
| char *
code.c:31:15: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘char (*)[100]’ [-Wformat=]
31 | scanf("%s%s", &str1, &str2);
| ~^ ~~~~~
| | |
| char * char (*)[100]
固定测试点#1:
固定测试点#2:
固定测试点#3:
附加测试点暂不可用
27【日期】黑色星期五——可以不用数组
#include <stdio.h>
#include <string.h>
void sortstring(char *str1, char *str2, char *result) {
int i = 0, j = 0, k = 0;
int len1 = strlen(str1);
int len2 = strlen(str2);
while (i < len1 && j < len2) {
if (str1[i] < str2[j]) {
result[k++] = str1[i++];
} else {
result[k++] = str2[j++];
}
}
while (i < len1) {
result[k++] = str1[i++];
}
while (j < len2) {
result[k++] = str2[j++];
}
result[k] = '\0';
}
int main() {
char str1[100], str2[100], result[200];
scanf("%s%s", &str1, &str2);
sortstring(str1, str2, result);
printf("%s\n", result);
return 0;
}