呵呵
可以了
忙了一个下午
#include <stdio.h>
#define A 10
#define B 5
float score[A][B];
float a_stu[A];
float a_cour[B];
int n,c;
void main()
{
int i,j;
float h;
float highest();
void input_stu();
void aver_stu();
void aver_cour();
input_stu();
aver_stu();
aver_cour();
printf("\nNO.
cour1
cour2
cour3
cour4
cour5
aver\n");
for(i=0;i<A;i++)
{printf("NO. %2d",i+1);
for(j=0;j<B;j++)
printf("%8.2f",score[i][j]);
printf("%8.2f\n",a_stu[i]);
}
printf("average:");
for(j=0;j<B;j++)
printf("%8.2f",a_cour[j]);
printf("\n");
h=highest();
printf("highest: %7.2f
NO. %2d
course %2d\n",h,n,c);
}
void input_stu()
{int i,j;
for(i=0;i<A;i++)
{printf("\n输入学生的分数: %2d: \n",i+1);
for(j=0;j<B;j++)
scanf("%f",&score[i][j]);
}
}
void aver_stu()
{int i,j;
float s;
for(i=0;i<A;i++)
{for(j=0;j<B;j++)
s+=score[i][j];
a_stu[i]=s/5.0;
s=0;
}
}
void aver_cour()
{int i,j;
float s;
for(j=0;j<B;j++)
{s=0;
for(i=0;i<A;i++)
s+=score[i][j];
a_cour[j]=s/(float)A;
}
}
float highest()
{float high;
int i,j;
high=score[0][0];
for(i=0;i<A;i++)
for(j=0;j<B;j++)
if(score[i][j]>high)
{high=score[i][j];
n=i+1;
c=j+1;
}
return(high);
}