#define M 4
#define N 11
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main() {
int i,k,j;
//FILE *fp;
char str[M][N],sum=0,temp[N];
printf("输入4个长度小于10的字符串\n");
for (i = 0; i < M; i++)
gets(str[i]);
printf("输入4个长度小于10的字符串\n");
for (i = 0; i<M - 1; i++){
k = i;
for (j = i + 1; j < M; j++){
if (strcmp(str[k], str[j]) > 0) //把小的调上来
k = j;
}
if (k != i){
strcpy(temp, str[k]);
strcpy(str[k], str[i]);
strcpy(str[i], temp);
}
}
i =0;
while (i<M )
{
printf("%s\n", str[i]);
i++;
}
}