【C语言】结构体数组:计算学生总成绩及计算高分学生信息
#include<stdio.h>
struct student
{
double xuehao;
char xingming[100];
int nian,yue,ri;
}s1[100];
int main()
{
int n,i,s;
while(scanf("%d",&n)!=EOF)
{
s=0;
for(i=0;i<n;i++)
{
scanf("%lf",&s1[i].xuehao);
scanf("%s",&s1[i].xingming);
scanf("%d %d %d",&s1[i].nian,&s1[i].yue,&s1[i].ri);
s=s1[i].nian+s1[i].yue+s1[i].ri;
if(s>270)
{
printf("%.0f %s %d %d %d\n",s1[i].xuehao,s1[i].xingming,s1[i].nian,s1[i].yue,s1[i].ri);
}
}
}
}
运行结果