P138-2源代码 C语言
#include <stdio.h> struct student{ char name[12]; char number[9]; int score; }; struct student st[3]={{"zhang liang","19040301",87},{"li hong","18040302",92},{"yan feng","20040303",83}}; struct student fun1(struct student pd[]){ struct student st1; st1=pd[0]; int max=pd[0].score,a; int len=sizeof(st)/sizeof(st[0]); for(a=1;a<len;a++) if (pd[a].score>max) st1=pd[a]; return st1; } main() { struct student st2; st2=fun1(st); printf("最高分姓名:%s,学号:%s,分数:%d",st2.number,st2.name,st2.score); getchar(); }