提交记录 #191
提交时间:2024-11-12 17:37:07
语言:c
状态:Accepted
编译情况:编译成功
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:
固定测试点#4:
固定测试点#5:
固定测试点#6:
固定测试点#7:
固定测试点#8:
固定测试点#9:
额外测试点#3600:
34【字符】合并字符串
#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;
}