请大家帮我看看吧!
#include<cstdio>#include<cstdlib>
#include<math.h>
#define N 10
#define M 5
float score[N][M];
float s_ver[N],a_cour[M];
int r,c;
int main()
{int i,j;
float h;
void s_aver(void); /*学生的平均分*/
void a_acour(void);/*每科的平均分*/
float highest(void);
float s_f();
void input(void);
input();
s_aver();
a_acour();
printf("No cour1 cour2 cour3 cour4 cour5 aver");
for(i=0;i<N;i++)
{printf("No.%d",i+1);
for(j=0;j<M;j++)
printf("%8.2f",score[i][j]);
printf("%8.2f\n",s_ver[i]);
}
printf("\naverage:\n");
for(j=0;j<M;j++)
printf("%8.2f",a_cour[j]);
printf("\n");
h=highest();
printf("highest=%8.2f No.%d course %d",h,r,c);
printf("variance %8.2f",s_f());}
void input()
{int i,j;
for(i=0;i<N;i++)
printf("input score of student%d:\n",i+1);
for(j=0;j<M;j++)
scanf("%f",&score[i][j]);
}
void s_aver()
{int i,j;
float s;
for(i=0;i<N;i++)
{for(j=0,s=0;j<M;j++)
s+=score[i][j];
s_ver[i]=s/5.0;
}
}
void a_acour()
{int i,j;
float s;
for(j=0;j<M;j++)
{s=0;
for(i=0;i<N;i++)
s+=score[i][j];
a_cour[j]=s/(float)N;
}
float highest()/*dec++编辑器出错的地方*/
{float high;
int i,j;
high=score[0][0];
for(i=0;i<N;i++)
for(j=0;j<M;j++)
if(score[i][j]>high)
{high=score[i][j];
r=i+1;
c=j+1; }
return(high);
}
float s_f()/*dec++编辑器出错的地方*/
{ int i;
float sumx=0.0,sumn0.0;
for(i=0;i<N;i++)
{sumx+=s_ver[i]*s_ver[i];
sumn+=s_ver[i];}
return(sumx/N-(sumn/N*sumn/N));
}
}