//cases of 41: there are n structure variables, with the student's student id, student number, and three grades, output the highest average score student information (including student id, name, 3 course grades and gpa)
# include # define N 3 Struct student { Int num. Char name [20]. Float score [3]. Float aver. }; Int main () { Void input (struct student s []); Struct student Max (struct student s []);/* 15 */ Void print (struct student s); Struct student s [N], * p=s; Input (p); Print (Max (p)); return 0; } Void input (struct student s []) { int i; Printf (" please input the student's information: student id, name, three classes: \ n "); for(i=0; i{ The scanf (" % d % s % f % f % f ", & amp; S [I]. Num, & amp; S [I]. Name, & amp; S [I] score [0], & amp; S [I] score [1], & amp; S [I] score [2]); S [I] aver=(s [I] score [0] + s [I] score [1] [I] + s score [2])/3; } } Struct student Max (struct student s [])/* 32 */ { Int I, m=0; for(i=0; iIf (s [I] aver> S [m]. Aver) M=I; Return s [m]; } Void print (struct student stud) { Printf (" \ n scores the highest of the students are: \ n "); Printf (" student number; % d \ n; % s \ n three classes grades: % 5.1 f, % 5.1 f, % 5.1 f \ n average grade: % 6.2 f \ n ", Stud. Num, stud. Name, stud. Score [0], stud. Score [1], stud. Score [2], stud. Aver); }
Function is line 15 and line 32, please? I have noted, bosses analyse, thank you!
CodePudding user response:
Line 15 is a function declaration, if not this line you call this function before 32 rows, it is can't find this function, complains, this line is tells the compiler I have this function, the function just write back, 32 lines to void print (struct student stud) in front of the line is a function prototype function (that is, you say)