编译函数,有runtime error怎么办、
#include<stdio.h>float score[10][5];
float stu[10];
float ave[5];
void student(void);
void average(void);
int highest(void);
main()
{
int i,j,n;
for(i=0;i<10;i++)
{
for(j=0;j<5;j++)
scanf("%f",&score[i][j]);
}
printf("Part 1: the averages of every student\n");
student();
for(i=0;i<10;i++)
printf("%f\n",stu[i]);
printf("Part 2: the averages of every course score\n");
average();
for(j=0;j<5;j++)
printf("%f\n",ave[j]);
printf("Part 3: a student and course scores of the student whose average is the highest\n");
n=highest();
printf("%d\n",n);
for(j=0;j<5;j++)
printf("%f\n",score[n][j]);
return 0;
}
void student(void)
{float s;
int i,j;
for(i=0;i<10;i++)
{
for(j=0,s=0;j<5;j++)
s+=score[i][j];
stu[i]=s/5.0;
}
}
void average(void)
{float s;
int i,j;
for(j=0;j<5;j++)
{
for(i=0,s=0;i<10;i++)
s+=score[i][j];
ave[j]=s/10.0;
}
}
int highest(void)
{
int i,k;
float high;
high=ave[0];
for(i=0;i<10;i++)
{
if(high<ave[i])
{high=ave[i];
k=i;}
}
return k;
}