//刚写的code,测试通过,如果有疑问,欢迎交流
#include<stdio.h>
#include<string.h>
#define N 100
void bubblesort_str(char list[][N],int len) //冒泡排序
{
int i,j;
char temp[N];
for(i=0;i<len - 1;i++)
for(j=0;j<len-i - 1;j++)
{
if(strcmp(list[j+1], list[j]) < 0)
{
strcpy(temp,list[j+1]);
strcpy(list[j+1], list[j]);
strcpy(list[j] ,temp);
}
}
}
int main(){
char name[5][N] = {"follow","basic","great wall", "fortran", "computer"};
bubblesort_str(name, 5);
int i;
for(i = 0; i<5; i++){
puts(name[i]);
}
}
追问大哥,说句题外话, 71354班的别看,老师说了雷同就零分,自重自重。。