3 回答

TA貢獻3593條經驗 獲得超0個贊

TA貢獻18條經驗 獲得超6個贊
#include <stdio.h>
#define N 10
//打印分數
int PScore(int score[])
{
??? int i;
??? printf("\n");
??? for(i=0;i<N;i++)
??? {
??????? printf("%d\n",score[i]);
??? }
??? printf("\n");
}
int JX(int score[])
{
??? int i,j;
??? for(i=N-2;i>=0;i--)
??? {
??????? for(j=0;j<=i;j++)
??????? {
??????????? if(score[j]<score[j+1])
??????????? {
??????????????? int temp;
??????????????? temp=score[j];
??????????????? score[j]=score[j+1];
??????????????? score[j+1]=temp;
??????????? }
??????? }
??? }
??? PScore(score);
}
int main()
{
??? int score[N]={67,98,75,63,82,79,81,91,66,84};
??? printf("-----------成績排名---------\n");
??? JX(score);
??? return 0;
}
改了一下jx函數的第一個for循環
- 3 回答
- 0 關注
- 2068 瀏覽
添加回答
舉報