#include <stdio.h>
struct Student
{
char No[11];
int Score;
};
int FindMaxScore(struct Student stu[], int n);
int main(void)
{
struct Student stus[3] = {{"2008030201", 89}, {"2008030202", 92}, {"2008030203", 78}};
int k;
3 分
printf("%s %d\n", stus[k].No, stus[k].Score);
return 0;
}
int FindMaxScore(3 分
)
{
int i, max, k=0;
max = stu[k].Score;
for (i=1; i<n; i++)
{
if (3 分
)
{
k = i;
max = stu[k].Score;
}
}
return k;
}
#include <stdio.h>
struct Student
{
char No[11];
int Score;
};
int FindMaxScore(struct Student stu[], int n);
int main(void)
{
struct Student stus[3] = {{"2008030201", 89}, {"2008030202", 92}, {"2008030203", 78}};
int k;
k = FindMaxScore(stus,3);
printf("%s %d\n", stus[k].No, stus[k].Score);
return 0;
}
int FindMaxScore(struct Student stu[], int n)
{
int i, max, k=0;
max = stu[k].Score;
for (i=1; i<n; i++)
{
if (stu[i].Score > max)
{
k = i;
max = stu[k].Score;
}
}
return k;
}
您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!