#include <stdio.h>
# define S 60.0
# define N 3
struct student
{
int n;
char name[10];
float score[3];
float ave;
};
int main ()
{
void input (struct student stu[]);
void bujige (struct student stu[]);
void youxiu (struct student stu[]);
struct student stu[N],*p=stu;
input (p);
bujige(p);
youxiu (p);
return 0;
}
void input (struct student stu[])
{
int i;
printf ("请输入各学生的学号姓名及三门课成绩:\n");
for (i=0;i<N;i++)
{
printf ("请输入第%d个学生信息:",i+1);
scanf ("%d-%s-%f-%f-%f",&stu[i].n,&stu[i].name,&stu[i].score[0],&stu[i].score[1],&stu[i].score[2]);
stu[i].ave=(stu[i].score[0]+stu[i].score[1]+stu[i].score[2])/3.0;
printf ("\n");
printf ("%f",stu[i].ave);
}
}
void bujige (struct student stu[])
{
int i,j,k=0;
for (i=0;i<N;i++)
{
for (j=0;j<3;j++)
{
if (stu[i].score[j]<S)
k++;
}
if (k>1)
{
printf ("\n");
printf ("学号:%d",stu[i].n);
for (j=0;j<3;j++)
{
if (stu[i].score[j]<S)
printf ("不及格成绩:%f ",stu[i].score[j]);
}
}
}
}
void youxiu (struct student stu[])
{
int i;
for (i=0;i<N;i++)
{
if (stu[i].ave>=85.0&&stu[i].ave<=90.0)
printf ("学号:%d 姓名:%s",stu[i].n,stu[i].name);
}
}