#include <stdio.h> |
struct student { |
int num; |
char name[20]; |
double score; |
}; |
struct student a[10] = {{101, "张飞" , 83}, {102, "李奎" , 29}, |
{103, "阿斗" , 35}, {104, "孙权" , 77}, |
{105, "曹操" , 65}, {106, "诸葛亮" , 90}, |
{107, "袁绍" , 49}, {108, "赵子龙" , 80}, |
{109, "赵本山" , 89}, {110, "潘长江" , 68}}; |
void main() { |
struct student max = a[0]; |
int i; |
for (i = 1; i < 10; i++) |
max = max.score > a[i].score ? max : a[i]; |
printf ( "%d %s %lf" , max.num, max.name, max.score); |
} |