#include?<string.h>
const?int?MAXLEN?=?100;
const?int?MAXSIZE?=?10;
void?sort(char?title[][MAXLEN],int?n)?{//排序
int?i,j,k;
char?tstr[MAXLEN];
for(i?=?0;?i?<?n?-?1;?++i)?{
k?=?i;
for(j?=?i?+?1;?j?<?n;?++j)?{
if(strcmp(title[k],title[j])?>?0)
k?=?j;
}
if(k?!=?i)?{
strcpy(tstr,title[k]);
strcpy(title[k],title[i]);
strcpy(title[i],tstr);
}
}
}
void?show(char?s[][MAXLEN],int?n)?{
int?i;
for(i?=?0;?i?<?n;?++i)
printf("%s",s[i]);
puts("?");
}
int?main(void)?{
char?s[MAXSIZE][MAXLEN];
int?i;
for(i?=?0;?i?<?MAXSIZE;?++i)?{
printf("string(%02d/%d):",i?+?1,MAXSIZE);
fgets(s[i],MAXLEN,stdin);
}
printf("排序前:\n");
show(s,MAXSIZE);
sort(s,MAXSIZE);
printf("排序後:\n");
show(s,MAXSIZE);
return?0;
}