int dec_score(int dec[])
{
int i,j,temp;
for(j = 0;j < 9;j++)
{
for(i = 0;i < 10 - j - 1;i++)
{
if(dec[i + 1] > dec[i])
{
temp = dec[i + 1];
dec[i + 1] = dec[i];
dec[i] = temp;
}
printf("成绩排名:%d\n",dec[i]);
}
return dec[i];
}
}
int main()
{
int score[]={67,98,75,63,82,79,81,91,66,84};
total_score(score);
ave_score(score);
high_score(score);
dec_score(score);
return 0;
}
for(i=8;i>=0;i--)
{
for(j=0;j<=i;j++)
{
if(score[j]<score[j+1])
{
temp=score[j];
score[j]=score[j+1];
score[j+1]=temp;
}
}
}
for(j = 0;j < 9;j++)
for(j = 9;j >=0;j--)
{
for(i = 0;i < j ;i++)
{
if(dec[i + 1] > dec[i])
{
temp = dec[i ];
dec[i ] = dec[i+1];
dec[i+1] = temp;
}
这样试试