该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
求平均成绩的!!
#include
#define M 5
#define N 3
void main()
{
void average_score(float score[M][N],float average_s[M],float average_k[N]);
void Max_min(float score[M][N],float Max[N],float Min[N]);
int number[M];
float average_s[M];
float average_k[N];
float Max[N],Min[N];
float score[M][N];
int i,j;
printf("please input \n");
printf("学号 英语 高数 计算机 :\n");
for (i=0;i
{
scanf("%d",&number[i]);
for(j=0;j
scanf("%f",&score[i][j]);
}
for (i=0;i
average_s[i]=0;
for (i=0;i
{
Max[i]=0;
Min[i]=100;
average_k[i]=0;
}
average_score(score,average_s,average_k);
Max_min(score,Max,Min);
printf("学号 英语 高数 计算机 :\n");
for (i=0;i
{
printf("%d",number[i]);
for(j=0;j
printf("%8.1f",score[i][j]);
printf("%8.1f",average_s[i]);
printf("\n");
}
printf("平均:\n");
for (i=0;i
printf("%8.1f",average_k[i]);
printf("\n 最大值 最小值:\n");
for (i=0;i
printf("%8.1f %10.1f \n",Max[i],Min[i]);
}
void average_score(float score[M][N],float average_s[M],float average_k[N])
{
int i,j;
for(i=0;i
for(j=0;j
average_s[i]=average_s[i]+score[i][j]/N;
for (i=0;i
for(j=0;j
average_k[j]=average_k[j]+score[i][j]/M;
}
void Max_min(float score[M][N],float Max[N],float Min[N])
{
int i,j;
for (i=0;i
for(j=0;j
if(Max[j]
for(i=0;i
for(j=0;j
if(Min[j]>score[i][j]) Min[j]=score[i][j];
}