求助大佬,看下哪里错了
#include <stdio.h>#include <stdlib.h>
void read(long num[],int score[],int n);
void av(int score[],int n);
void scoredes(long num[],int score[],int n);
void swap(int *x,int *y);
void swapnum(long *x,long *y);
int main()
{
int order,n;
int score[30];
long num[30];
printf("1.Input record\n");
printf("2.Calculate total and average score of course\n");
printf("3.Sort in descending order by score\n");
printf("4.Sort in ascending order by number\n");
printf("5.Search by number\n");
printf("6.Statistic analysis\n");
printf("7.List record\n");
printf("0.Exit\n");
while(1)
{
printf("Please enter your choice:\n");
scanf("%d",&order);
if(order==0)break; //输入0时退出程序
if(order==1) //输入1时记录数据
{
printf("how many students?\n");
scanf("%d",&n);
read(num,score,n);
}
if(order==2) //输入2时计算总分与平均分
av(score,n);
if(order==3) //输入3时按成绩降序输出
scoredes(num,score,n);
}
return 0;
}
void swap(int *x,int *y)//交换int型数
{
int p;
p=*x;
*x=*y;
*y=p;
}
void swapnum(long *x,long *y)//交换long型数
{
long p;
p=*x;
*x=*y;
*y=p;
}
void read(long num[],int score[],int n)//读入数据
{
int i;
for(i=0;i<n;i++)
{
printf("Input student's ID and score:");
scanf("%ld%d",&num[i],&score[i]);
}
}
void av(int score[],int n)//计算总分与平均分
{
double x;
int y=0,i;
for(i=0;i<n;i++)
{
y+=score[i];
}
x=y/n;
printf("sum is %d \naverage is %.2lf",y,x);
}
void scoredes(long num[],int score[],int n)//按成绩降序输出
{
int i,j;
for(i=0;i<n;i++)
{
for(j=n;j>i;j--)
{
if(score[j]<score[j-1])
{
swap(&score[j],&score[j-1]);
swapnum(&num[j],&num[j-1]);
}
}
}
for(i=0;i<n;i++)
{
printf("%ld\t\t%d\n",num[i],score[i]);
}
}
cb里显示||error: ld returned 1 exit status|