edit b.c
This commit is contained in:
parent
3ad0a253c6
commit
0f49a1ebae
1 changed files with 12 additions and 12 deletions
24
abc042/b.c
24
abc042/b.c
|
@ -2,33 +2,33 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int compare_strings(const void *string1, const void *string2);
|
||||
int cmp_str(const void *str1, const void *str2);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int i;
|
||||
int number_strings;
|
||||
int string_length;
|
||||
char strings[100][100 + 1];
|
||||
int num;
|
||||
int len;
|
||||
char strs[100][100 + 1];
|
||||
|
||||
scanf("%d %d", &number_strings, &string_length);
|
||||
scanf("%d %d", &num, &len);
|
||||
i = 0;
|
||||
while (i < number_strings)
|
||||
while (i < num)
|
||||
{
|
||||
scanf("%s", strings[i]);
|
||||
scanf("%s", strs[i]);
|
||||
++i;
|
||||
}
|
||||
qsort(strings, number_strings, sizeof(strings[0]), compare_strings);
|
||||
qsort(strs, num, sizeof(strs[0]), cmp_str);
|
||||
i = 0;
|
||||
while (i < number_strings)
|
||||
while (i < num)
|
||||
{
|
||||
printf("%s", strings[i]);
|
||||
printf("%s", strs[i]);
|
||||
++i;
|
||||
}
|
||||
puts("");
|
||||
}
|
||||
|
||||
int compare_strings(const void *string1, const void *string2)
|
||||
int cmp_str(const void *str1, const void *str2)
|
||||
{
|
||||
return (strcmp(string1, string2));
|
||||
return (strcmp(str1, str2));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue