請(qǐng)大神幫忙看下這排序的函數(shù)問(wèn)題出在哪里
打印出的結(jié)果為
67
0
98
98
98
98
98
98
98
98
int order()
{
? ? int i,j,t;
? ? for(i=0;i<9;i++)
? ? {
? ? ? ? for(j=0;j<=9-i;j++)
? ? ? ? {
? ? ? ? ? ? if(score[j]>score[j+1])
? ? ? ? ? ? {
? ? ? ? ? ? ? ? t = score[j];
? ? ? ? ? ? ? ? score[j] = score[j+1];
? ? ? ? ? ? ? ? score[j+1] = t;
? ? ? ? ? ? ? ??
? ? ? ? ? ? }
? ? ? ? ? ?
? ? ? ? }
? ??
? ??
? ? }
? ? int x;
? ? for(x=0;x<10;x++)
? ? {
? ? ? ? printf("%d\n",score[x]);
? ? ? ??
? ? ? ??
? ? }
?return 0;
}
2016-09-13
第二層for循環(huán)改為j<9-i;