C语言运行错误,度娘找不到答案,求各位大神解惑???
#include<stdio.h>#include<conio.h>
int aver1[10],aver2[5],s,c;
void student(int ave[5][10])/*学生平均分*/
{
int i,j,sum[10];
for(j=0;j<10;j++)
for(i=0;i<5;i++)
{
sum[j]=sum[j]+ave[i][j];
aver1[j]=sum[j]/5;
}
}
void course(int ave[5][10])/*科目平均分*/
{
int sum[10],i,j;
for(i=0;i<5;i++)
for(j=0;j<10;j++)
{
sum[i]=sum[i]+ave[i][j];
aver2[i]=sum[i]/10;
}
}
void score(int ave[5][10])/*最高分所对应的学生和科目*/
{
int i,j,t;
t=ave[0][0];
for(i=0;i<5;i++)
for(j=0;j<10;j++)
if(ave[i][j]>t)
{
t=ave[i][j];
c=i;
s=j;
}
}
int main()
{
int i,j,sc[5][10];
printf("please input scores:");
for(i=0;i<5;i++)
for(j=0;j<10;j++)
scanf("%d",&sc[i][j]);
student(sc[5][10]);<<--//运行错误提示都指向这三处求各位大神解惑???
course(sc[5][10]);<<--//运行错误提示都指向这三处求各位大神解惑???
score(sc[5][10]);<<--//运行错误提示都指向这三处求各位大神解惑???
printf("students average scores:");
for(j=0;j<10;j++)
printf(" %d号学生平均分是%d\n",j,aver1[j]);
printf("course average scores:");
for(i=0;i<5;i++)
printf("%d号课目的平均分是%d\n",i,aver2[i]);
printf("最高分所对应的是%d号学生,%d号课目",s,c);
getch();
return(0);
}
F:\c program\习题712.cpp(44) : error C2664: 'student' : cannot convert parameter 1 from 'int' to 'int [][10]'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
F:\c program\习题712.cpp(45) : error C2664: 'course' : cannot convert parameter 1 from 'int' to 'int [][10]'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
F:\c program\习题712.cpp(46) : error C2664: 'score' : cannot convert parameter 1 from 'int' to 'int [][10]'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
执行 cl.exe 时出错.
习题712.obj - 1 error(s), 0 warning(s)