选择法对字符的二维数组排序

对100个名字进行选择法排序
先比较首字母,首字母相同比较下个字母,以此类推

#include<stdio.h>
#include<string.h>
int main(){
    int t;
    char s[100][61];
    char ch[61];
    while(scanf("%d",&t)!=EOF){
        getchar();//吸收多余的换行符
        for(int i=0;i<t;i++){
            gets(s[i]);
        }
        for(int i=0;i<t-1;i++){
            for(int j=0;j<t-i-1;j++){
                if(strcmp(s[j],s[j+1])<0){//对字符串数组元素进行比较
                    strcpy(ch, s[j]);//交换两个字符串数组的元素
                    strcpy(s[j], s[j + 1]);
                    strcpy(s[j + 1],ch);
                }
            }
        }
        for(int i=0;i<t;i++){
            printf("%s",s[i]);//输出
            if(i!=t-1){
                printf(" ");
            }
        }
        printf("\n");
    }
} 
1