CodePudding user response:
#include
Struct student
{
Char name [10].
Int id;
Float score;
};
Void input_stu (struct student stu [], int n)
{
int i;
for(i=0; i{
The scanf (" % d % s % f ", & amp; Stu [I]. Id, & amp; Stu [I]. Name, & amp; Stu [I] score);
}
}
Int max_score (struct student stu [], int n)
{
Int I, j, temp=0;
for(i=0; i{
If (temp & lt; Stu [I] score)
{
Temp=stu [I] score;
J=I;
}
}
Return stu [j] score;
}
Void find_stu (struct student stu [], int n, int m)
{
Int I, j=0;
for (i=0; i{
If (m==stu [I] id)
{
J=max_score (stu, n);
If (j)==m
{
Printf (" top ");
}
The else
{
Printf (" score: % 2 f ", stu [I] score).
}
}
}
}
Int main ()
{
int m;
Struct student stu [5]={0};
Input_stu (stu, 5);
Printf (" input to query student id: \ n ");
The scanf (" % d ", & amp; M);
Find_stu (stu, 5, m);
return 0;
}