# include & ltstring.h & gt
#定義M 9
#定義N 5
int main(void)
{
int i,j;
炭化溫度[M];
char str[N][M]={"Pascal "," Basic "," Fortran "," Java "," Visual C " };
printf(" befoe sorted:\ n ");
for(I = 0;我& ltn;i++)
{
?puts(str[I]);
}
for(I = 0;我& ltn-1;i++)
{
?for(j = I+1;j & ltn;j++)
?{
if(strcmp(str[j],str[I])& lt;0)/*已更改*/
?{
?strcpy(temp,str[I]);/*已更改*/
?strcpy(str[i],str[j]);
?strcpy(str[j],temp);
?}
?}
}
printf("排序後:\ n ");
for(I = 0;我& ltn;i++)
{
?puts(str[I]);
}
返回0;
}