哪里錯(cuò)了呀??*-*
#include <stdio.h>
void arrange(int score[])
{
? ? int i,j,temp;
? ? for(i=9;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;
? ? ? ? ? ? }
? ? ? ? }
? ? }
? ? printf("\n-----排序之后-----\n");
? ? for(i=0;i<10;i++)
? ? {
? ? ? ? if(i!=9)
? ? ? ? {
? ? ? ? ? ? printf("%d,",score[i]);
? ? ? ? }
? ? ? ? else
? ? ? ? {
? ? ? ? ? ? printf("%d",score[i]);
? ? ? ? }
}
int main()
{
? ? int score[]={67,98,75,63,82,79,81,91,66,84};
? ? int i,sum;
? ? sum=0;
? ? for(i=0;i<9;i++)
? ? {
? ? ? ? sum=sum+score[i];
? ? }
? ? printf("總分:%d\n",sum);
? ? printf("平均分:%d\n",sum/10);
? ? printf("最高分:%d",score[0]);
? ? printf("最低分:%d",score[9]);
? ? arrange(score);
? ? return 0;
}
提示是
hello.c: In function 'arrange':
hello.c:45:1: error: expected declaration or statement at end of input
}
^
2017-12-03
可是最大最小值不對(duì)啊
2017-12-03
原來(lái)是少一個(gè)大括號(hào)