功能实现:
#include<stdio.h>
#include<string.h>
void main()
{
void cmp(char*x,char*y);
char *word[]={"Follow me","Basic","Great wall","Fortran","Computer Design"};
char *p;
int i,j,n=5;
for(i=0;i<5;i++)
puts(word[i]);
for(j=0;j<n-1;j++)
{
for(i=0;i<n-1-j;i++)
if(strcmp(word[i],word[i+1])>0)
{
p=word[i];
word[i]=word[i+1];
word[i+1]=p;
}
}
printf("\n");
for(i=0;i<5;i++)
puts(word[i]);
}
#include<stdio.h>
#include<string.h>
void main()
{
void cmp(char*x,char*y);
char *word[]={"Follow me","Basic","Great wall","Fortran","Computer Design"};
char *p;
int i,j,n=5;
for(i=0;i<5;i++)
puts(word[i]);
for(j=0;j<n-1;j++)
{
for(i=0;i<n-1-j;i++)
if(strcmp(word[i],word[i+1])>0)
{
p=word[i];
word[i]=word[i+1];
word[i+1]=p;
}
}
printf("\n");
for(i=0;i<5;i++)
puts(word[i]);
}
既然还有不甘心
就还没到放弃的时候~