排序
#include<stdio.h>
#include<string.h>
//排序
void sort(int n, char str[1001][101]) {
int flag = 0; //排序结束标志位
for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < n - 1 - i; j++) {
char move[101];
if (strcmp(str[j], str[j + 1]) > 0) {
strcpy(move, str[j]);
strcpy(str[j], str[j + 1]);
strcpy(str[j + 1], move);
flag = 1;
}
} if (flag = 0) break;
}
}
int main() {
char str[1001][101] = {'\0'};
int n;
while (~scanf("%d", &n)) {
for (int i = 0; i < n; i++) {
scanf("%s", str[i]); // printf("%s\n",str[i]);
}
sort(n, str);
for (int j = 0; j < n; j++)
printf("%s\n", str[j]);
}
}