CodePudding user response:
#include#include
/* run this program using the console pauser or add your own getch, system (" pause ") or the input loop */
Void aver1 (int * p, int * n1, int * m1);//students average score
Void aver2 (int * q, int * n1, int * m1);//course average score
Int main (int arg c, char * argv []) {
Int n, m, * n1, * m1;//n representative, m on behalf of the column of
Printf (" please enter the number of students and course gate number: ");
The scanf (" % d % d ", & amp; N, & amp; M);
N1=& amp; n; M1=& amp; m;
Int a, [n] [m].
int i,j;
for(i=0; i
Printf (" please enter the first % d student achievement: ", I + 1);
for(j=0; J
The scanf (" % d ", & amp; A [I] [j]);
}
}
Int * p, * q;
P=& amp; A [0] [0];
Q=& amp; A [0] [0];
Aver1 (p, n1, m1);
Aver2 (q, n1, m1);
return 0;
}
Void aver1 (int * p, int * n1, int * m1)
{
int i,j;
Int sum [50];
Float aver1;
for(i=0; i<* n1. I++)
{
The sum of [0]=0;
for(j=0; J<* m1; J++)
{
Sum [I] + + j=* (p + I);
Aver1=((float) sum [I])/(m1) (float) *;
}
Printf (" % d a student's grade point average to % 2 f points \ n ", I + 1, aver1);
}
printf("\n");
}
Void aver2 (int * q, int * n1, int * m1)
{
int i,j;
Int sum [50];
Float aver2;
for(j=0; J<* m1; J++)
{
The sum of [0]=0;
for(i=0; i<* n1. I++)
{
Sum [j] +=x + j (q + I);
[j] aver2=((float) sum)/((float) * n1);
}
Printf (" % d a course. The average scores for % 2 f points \ n ", j + 1, aver2);
}
}
CodePudding user response:
Write a function that statistical n m course students, each student's score and the average score of every course, in the main function of the input 5 students score 4 course, call a function, output each student's grade point average and the average score of every course, requirements, do not allow the use of global variables and the global array,CodePudding user response: