1, Function: Enter 6 Student's 5 course result, calculate each student's average score and each course's average score.
2, C language Implementation code: (In fact, is the use of two-dimensional arrays to implement, the two-dimensional array of reference transfer using the array pointer to complete)
Copy Code code as follows:
#include <stdio.h>
#define STUDENT 5
#define SCORE 6
Void Input_array (float (*score) [STUDENT]);
Void Avg_score (float (*score) [STUDENT]);
Void Avg_course (float (*score) [STUDENT]);
/**
* Calculate student average score and course average.
*/
int main () {
Float Socore T];
Input_array (a);
Avg_course (a);
Avg_score (a);
}
Void Input_array (float (*score) [STUDENT]) {
int i, J;
for (i=0; i<score; i++) {
printf ("Input"% D Student Score: ", i+1);
for (j=0; j<student; J + +) {
scanf ("%f", Score[i] + j);
}
}
}
void Avg_course (float (*score) [STUDENT]) {
int i,j;
float S;
for (j=0; j<student; j +) {
printf ("course%d", j);
}
printf ("n");
for (i=0; i<score; i++) {
s=0;
for (j=0; j<student; j +) {
printf ("%f", * (SCORE [i] + j));
S + = * (Score[i] + j);
}
printf ("Ts=%f, Avg=%fn", s,s/student);
}
}
void Avg_score (float (*score) [STUDENT]) {
int i,j;
Float S;
for (i=0; i<student; i++) {
s = 0;
for (j=0; j<score;j++) {
s+= * (score[j]+i);
}
printf ("%f", S/score);
}
}