发布网友 发布时间:2024-10-23 16:57
共1个回答
热心网友 时间:2024-11-07 07:47
#include<stdio.h>
main()
{ typedef struct student{int sore; struct student next;
}students;
printf("请输入学生的成绩,结束请输入a");
students *head,*p,*q;int mun=0,avg,n=1;
head=(students *)malloc(sizeof(students));
scanf("%d",&head->sore);
mum=mun+head->sore;
p=head;
q=p;
while(p->sore!=a)
{
p=(students *)malloc(sizeof(students));
scanf("%d",&p->sore);
mum=mun+p->sore;
n=n+1;
q->next=p;
q=p;
}
avg=sum/n;
printf("学生的平均成绩为%d",avg)
}