2//# define N N is the number of M is subject for
# define M 3
Float score [N] [M].
Float a_stu [N].
Float a_cour [M];
Int a, b;//mark the location of the highest score
Int main ()
{
Int I, m;
Float h;
Void input_stu (void);
Void aver_stu (void);//students score
Void aver_cour (void);//subject score
Float highest (void);//performance is the largest, and the corresponding and subject
Float fancha (void);//variance
Input_stu ();
Aver_stu ();
Aver_cour ();
Printf (" student cour1 cour2 cour3 aver \ n ");
for (i=0; I & lt; N; I++)
Printf (" \ n % 5 d ", I + 1);
{
For (m=0; M & lt; M; M++)
Printf (" % 8.2 f ", score [I] [m]);
Printf (" % 8.2 f \ n ", a_stu [I]);
}
For (m=0; M & lt; M; M++)
Printf (" course aver % d: % f \ n ", m + 1, a_cour [m]);
H=highest ();
Printf (" student % d 'scour % d highese socre: % f ", a, b, h);
return 0;
}
Void input_stu (void)
{
Int I, m;
for (i=0; I & lt; N; I++)
{
Printf (" \ ninput student % d 's score \ n ", I + 1);
For (m=0; M & lt; M; M++)
Scanf_s (" % f ", & amp; Score [I] [m]);
}
}
Void aver_stu (void)
{int I, m;
Float sum=0, aver;
for (i=0; I & lt; N; I++)
{
For (m=0; M & lt; M; M++)
{
Sum=sum + score [I] [m].
}
A_stu [I]=sum/M (float);
}
}
Void aver_cour (void)
{
Int I, m;
Float sum=0, aver;
for (i=0; I & lt; M; I++)
{
For (m=0; M & lt; N; M++)
{
Sum=sum + score [I] [m].
}
A_cour [I]=sum/(float) N;
}
}
Float highest ()
{
Int I, m;
Float high;
High score=[0] [0];
for (i=0; I & lt; M; I++)
{
For (m=0; M & lt; N; M++)
{
If (high & gt; Score [I] [m])
{
High score=[I] [m].
B + 1;
}
A + 1;
}
Return (high);
}
}
Float fancha (void)
{
Int I, m;
Float n, sum=0;
for (i=0; I & lt; N; I++)
{
For (m=0; M & lt; M; M++)
Sum=sum + (score [I] [m] - a_stu [N]) * (score [I] [m] - a_stu [N]);
}
N=sum/n;
Return (n);
}
CodePudding user response:
Haven't made a mistake, the program runs to the back of the last sentence, pulled out of the normal,CodePudding user response: