#include
20 # define m
Void main ()
{
Char id [m];
Char name [m];
Float a, [m].
Float b [m];
Float c [m];
Int I, n, k=0;
Float s1=0, s2=0, s3=0;
Float sum1=0, sum2=0;
The scanf (" % d ", & amp; n);
for(i=0; i
}
for(i=0; i
}
for(i=0; i
}
Printf (" % % 1 f, % 1 f, 1 f \ n ", s1/n, s2/n, s3/n);
Printf (" % s % s % % 1 f, % 1 f, 1 f \ n ", id [k], the name [k], a [k], [k], b c [k]);
}
CodePudding user response:
Char id [m];Char name [m];
The two character array can store n a student's name and student id?
Suggested that students with structure array to store information
CodePudding user response:
Char id [m];Char name [m];
Here is wrong, two id, if id is not a number, should be a two dimensional array id [2] [m]. The name [2] [m].
Here the wrong cause you output
Printf (" % s % s % % 1 f, % 1 f, 1 f \ n ", id [k], the name [k], a [k], [k], b c [k]); Here also wrong
Should be printf (" % s % s %. 1 f %. 1 f %. 1 f \ n ", & amp; Id [k] [0], & amp; The name [k] [0], a [k], [k], b c [k]);
for(i=0; i
}
Here is wrong, two are in sum1 to calculate the total score,
Two id should be a two dimensional array