#include
#include
typedef struct student
{
int number,score1,score2,score3;
struct student *next;
}
ST,*STU;
STU createlink(int n)
{
int i;
STU p,q,head;
if(n<=0)
return(NULL);
head=(STU)malloc(sizeof(ST));
printf("请依次输入学生学号、第一门主课、第二门主课、副课的成绩,中间用一个空格隔开:\n");
scanf("%d %d %d %d",&head->number,&head->score1,&head->score2,&head->score3);
p=head;
for(i=1;i
{
q=(STU)malloc(sizeof(ST));
scanf("%d %d %d %d",&q->number,&q->score1,&q->score2,&q->score3);
p->next=q;
p=q;
}
p->next=NULL;
return(head);
}
void list(STU head)
{
STU p=head;
printf("满足条件的学生:\n");
while(p!=NULL)
{
if((p->score1+p->score2+p->score3)>270||p->score1>95&&p->score2>95&&p->score3>=70||p->score1==100&&p->score2>=80&&p->score3>=80||p->score2==100&&p->score1>=80&&p->score3>=80)
{
printf("学号:%d 三门课成绩:%d %d %d\t平均分:%d\n",p->number,p->score1,p->score2,p->score3,(p->score1+p->score2+p->score3)/3);
}
p=p->next;
}
}
void main()
{
STU h;
int n;
printf("请输入学生的个数:");
scanf("%d",&n);
h=createlink((int)n);
list(h);
}