#include <stdio.h>
#define N 100
struct stu {
char name[10];
char num[10];
int score[3];
};
int i;
void get(struct stu *st,int n)
{
for(i=0;i<n;i++)
scanf("%s %s %d %d %d",st[i].name,st[i].num,st[i].score,st[i].score+1,st[i].score+2);
}
void average(struct stu *st,int n)
{
int sum[3]={0,0,0};
for(i=0;i<n;i++)
{
sum[0]+=st[i].score[0];
sum[1]+=st[i].score[1];
sum[2]+=st[i].score[2];
}
sum[0]/=n;
sum[1]/=n;
sum[2]/=n;
printf("%d %d %d\n",sum[0],sum[1],sum[2]);
}
void max(struct stu *st,int n)
{
int sum,max,s=0;
sum=st[0].score[0]+st[0].score[1]+st[0].score[2];
max=0;
for(i=1;i<n;i++)
{
s=st[i].score[0]+st[i].score[1]+st[i].score[2];
if(s>sum)
{
sum=s;
max=i;
}
}
printf("%s %s %d %d %d" ,st[max].name,st[max].num,st[max].score[0],st[max].score[1],st[max].score[2]);
}
int main (void)
{
struct stu st[N];
int n;
scanf("%d",&n);
get(st,n);
average(st,n);
max(st,n);
return 0;
}
0.0分
1 人评分
数组输出 (C语言代码)--此题的题目描述有问题浏览:1818 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:530 |
1025题解浏览:744 |
C语言程序设计教程(第三版)课后习题10.1 (C语言代码)浏览:539 |
单词个数统计 (C语言代码)浏览:1014 |
字符串的修改 (C语言代码)浏览:1159 |
P1002 (C语言代码)浏览:970 |
Manchester- Hello, world!浏览:13081 |
P1025 (C语言代码)浏览:995 |
最大连续子序列浏览:1034 |