c语言问题,紧急,谢谢!

来源:百度知道 编辑:UC知道 时间:2024/05/16 01:43:13
有一个班的4个学生,5门课。
1 求第一门课平均分
2 找出两门以上课程不及格的学生,输出其学号,和全部课程成绩和平均成绩
3 找出平均成绩90以上或全部课程成绩85分以上学生
分别编三个函数实现这3个要求
各位帮忙啊,看见这题目我要晕了...

typedef struct
{
char name[10];//学生名
float sub1;// 课程1;
float sub2;// 课程2;
float sub3;// 课程3;
float sub4;// 课程4;
} student;
float temp_av(student a,student b,student c,student d) //平均分
{
return((a.sub1+b.sub1+c.sub1+d.sub1)/4);
}

BOOLEAN whoisbadguy(student a) //不及格的学生
{
int temp;
if(a.sub1<60)
temp=temp+1;
if(a.sub2<60)
temp=temp+1;
if(a.sub3<60)
temp=temp+1;
if(a.sub4<60)
temp=temp+1;
if(temp>=2)
return(TRUE);
else
return(FALSE);
}
BOOLEAN whoisgoodguy(student a) //不及格的学生
{
if((((a.sub1+a.sub2+a.sub3+a.sub4)/4)>=90)|
(a.sub1>=85 &&a.sub2>=85 && a.sub3>=85 && a.sub4>=85))

return(TRUE);
else
return(FALSE);
}

#include <stdio.h>
#include <string.h>
struct student
{
char name[15];
int number;