And we haven't learned a pointer, can only use simple function
# include & lt; Stdio. H>
Int main () {
int i,j;
Float a [5], [4], the sum [4]={0};
Printf (" \ t 2 \ \ t course 1 \ t t 3 \ t course 4 \ n ");
for(i=0; i<5; I++) {
Printf (" % d ", I + 1);
for(j=0; J<4. J++)
The scanf (" % f ", & amp; A [I] [j]);
}
for(j=0; J<4. J++)
for(i=0; i<5; I++)
The sum [I] +=a, [I] [j].
Printf (" the result for t \ \ t \ n ");
Printf (" \ t 1 \ t course 2 \ t 3 \ t course scored an average 4 \ t \ n ");
for(i=0; i<5; I++) {
Printf (" \ n students % d: \ t ", I + 1);
for(j=0; J<4. J++)
Printf (" % 1 \ t f ", a [I] [j]);
Printf (" % 1 f ", sum [I]/4);
printf("\n");
}
return 0;
}
CodePudding user response:
The same question, don't have to repeatedly postWrite code to sort the sum to do, and then in the sorting process of sum data exchange content came out of an array of synchronous exchange a
Just this one step
CodePudding user response:
# include# define N 5
The main ()
{
Int a [N] [5], I, j, N, x, y, z;
Printf (" please enter student id and attendance points, interior points \ n ");
for(i=0; i
{the scanf (" % d ", & amp; A [I] [j]); }
for(i=0; i
For (a [I] [3]=0, j=1; J<3; J++)
{a [I] [3] +=a, [I] [j]. }
}
Printf (" please enter a query student id: ");
The scanf (" % d ", & amp; n);
i=0;
While (i
If (i
Printf (" the student's attendance points, interior points, total score is: ");
for(j=1; J<4. J++)
Printf (" % 4 d ", a [I] [j]);
printf("\n");
}
The else printf (" the student you are looking for does not exist \ n ");
for(i=0; i
for(j=i+1; J
For (z=0; Z<4. Z++)
If (a [I] [3] {
X=a, [I] [z].
A [I] [z]=a, [j] [z].
A [j] [z]=x;
}
}
}
for(i=0; i
Printf (" output after sorting result table \ n ");
Printf (" student id attendance interior points total score ranking \ n ");
Printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \ n ");
for(i=0; i
for(j=0; J<5; J++)
Printf (" % d "6, a [I] [j]);
printf("\n");
}
}//you can consult me to write this topic
CodePudding user response:
Fun