Home > Back-end >  A spirited bug, the highest embodied in English sometimes make mistakes (behave) varies according to
A spirited bug, the highest embodied in English sometimes make mistakes (behave) varies according to

Time:09-26

#include
Int main ()
{
Int a [100] [100], c [3].//result \ high score
Int I, j, k;//I for subject subscript, j subscript, for students to pass the number
Double b [3], [3] d;//subjects average \ pass rate
Double sum;
Printf (" input the score (input by subject (order) of Chinese maths English \ n ");
for(i=1; I<=3; I++) {
for(j=1; J<=5; J++) {
The scanf (" % d ", & amp; A [I] [j]);
Sum=sum + a, [I] [j].
If (a [I] [j] & gt;=60) k=k + 1;
If (a [I] [j] & gt; A [I] [1]) c=[I] a [I] [j];
}
[I]=sum/5 b;
D [I]=100 * k/5;
Sum=0; K=0;
}
Printf (" Chinese grade point average is: % f, highest can be divided into: % d, pass rate is: % f \ n ", "b" [1], c [1], [1] d);
Printf (" mathematics grade point average is: % f, highest can be divided into: % d, pass rate is: % f \ n ", "b" [2], c [2], [2] d);
Printf (" average scores for English: % f, the highest is divided into: % d, pass rate is: % f \ n ", b [3], c [3], [3] d);
}

CodePudding user response:

After you define the variable remember initialise!
Double sum=0;

CodePudding user response:

And c subscript starting from 0, 1 you start cycle, I 3, c [3] were crossing the line

CodePudding user response:

This is not the most important, after the change is so, the code error is
If (a [I] [j] & gt; A [I] [1]) c=[I] a [I] [j];
Sometimes failure, if took a larger value in the middle, and it will be one loop will c [I] replaced with smaller values, and then continue to run, for example,
Enter 67 46 91 4 8 (English) the highest output is divided into eight,
  • Related