# include & lt; stdio.h>
# define ARR_SIZE 30
/* * * * * * * * * * * * the Begin * * * * * * * * * * */
//plus input student information function declarations here
/* * * * * * * * * * * * End * * * * * * * * * * * * */
Int main (void)
{
int n;
Float score [ARR_SIZE];
Long num [ARR_SIZE];
Printf (" do enter num and score until score
//here add function call
/* * * * * * * * * * * * End * * * * * * * * * * * * */
Printf (" Total students: % d \ n ", n);
return 0;
}
//function function: input from the keyboard class students of a course and student id
//when the input result is negative, the total input end () function returns the
/* * * * * * * * * * * * the Begin * * * * * * * * * * */
/* * * * * * * * * * * * End * * * * * * * * * * * * */
CodePudding user response:
The first level:
# include & lt; stdio.h>
# define ARR_SIZE 30
/* * * * * * * * * * * * the Begin * * * * * * * * * * */
//plus input student information function declarations here
Int PrintArr (float * score, long * num);
/* * * * * * * * * * * * End * * * * * * * * * * * * */
Int main (void)
{
int n;
Float score [ARR_SIZE];
Long num [ARR_SIZE];
Printf (" do enter num and score until score
/* * * * * * * * * * * * the Begin * * * * * * * * * * */
//here add function call
N=PrintArr (score, num);
/* * * * * * * * * * * * End * * * * * * * * * * * * */
Printf (" Total students: % d \ n ", n);
Return 0;
}
Int PrintArr (float * score, long * num)
{
Int I=0, n=0;
While (1)
{
The scanf (" % ld % f ", & amp; Num [I], & amp; n);
If (n & gt;=0)
{
Score [I]=n;
i++;
If (i>=ARR_SIZE)
break;
}
The else
{
break;
}
}
return i;
}
On their ideas are as follows: the second,
1. 2 declare two variables as a counter, such as m=0; X=0; Through the array, if the result is less than 60, counter m++; Printing student number at the same time; If the result is greater than or equal to 60, counter x++, print student number at the same time, the array traversal printed after the completion of m, x,
3. Declare a temporary int temp [5], and then iterate through group judgment,
If (score [I] <60)
\ [0] + +;
Else if (score [I] & gt;=60 & amp; & Score [I] <70)
Temp [1] + +;
Else if (score [I] & gt;=70 & amp; & Score [I] <80)
\ [2] + +;
Else if (score [I] & gt;=80 & amp; & Score [I] <90)
\ [3] + +;
Else if (score [I] & gt;=90 & amp; & Score [I] <100)
\ [4] + +;
Then each percentage point:
\ [0]/30 * 100
Other analogy