名:%-11s电话号码:%-19s科
数:%-5d\\n\\n\stu->phone ,stu->subject );
for(j=0,l=1;j
{printf(\----------\\n\
printf(\②选课具体信息:\printf(\第%d科####\\n\printf(\printf(\课程编号:%-19s课程名称:%-19s学
分:%-d\\n\\n\printf(\考试成绩:%-19.1f平时成绩:%-19.1f综
合:%-.1f\\n\\n\printf(\③考试情况(若是fail则需重修):%s\\n\printf(\if(strcmp(\
{printf(\重修次数:%-20d\\n\\n\for(i=0;i
数:%-20.1f\\n\} }
}stu=stu->next; }
printf(\----------\
printf(\共 有 - 位 学 生 的 信 息,已 全 部 输 出\\n\ }
//####################################### 五
######################################################## //####################################统计个人平均###################################################
struct ave *studentave(struct student *head)//构建学生平均成绩链表 {
struct student *p1;
struct ave *s,*heads,*p;
struct ave *pp1; // ceshi
float a=0,sum=0;
int i=0,n=1,l=0,f=0;
int k; //ceshi
system(\ p1=head;
if(head==NULL) {
printf(\对不起,还没有学生的信息,请问是否输入新信息,若要请输入 1 ;否则请输入任一数字 \\n\\n\ scanf(\ if(l==1) {
head=creat();write(head);
printf(\信息输入完毕,请问是否马山统计并输出学生的排名信息,若是请输入 1 否则输入任一数字\\n\\n\ scanf(\
if(f==1){head=out();heads=studentave(head);sequence(heads);} else _exit(0); }
else {system(\ } else {
printf(\==============\\n\ while(p1!=NULL) {
if(p1->Class
s=(struct ave*)malloc(sizeof(struct ave));//开辟空间 sum=0;
for(i=0;i
sum=sum+p1->cou[i].total;//各门课程总成绩相加 s->s[i].final=p1->cou[i].final;
s->s[i].performance=p1->cou[i].performance; s->s[i].total=p1->cou[i].total;
printf(\考试成绩:%-9.1f平时成绩:%-9.1f综合成
绩:%-9.1f\\n\
strcpy(s->s[i].name,p1->cou[i].name);//把课程结构体的考试成绩,平时成绩,总成绩,课程名放到平均分结构体中 }
a=sum/p1->subject;//每个学生的平均分 printf(\平均分:%-9.1f\ s->studentave=a;
s->subjects=p1->subject;
s->Class=p1->Class;
strcpy(s->number,p1->num);
strcpy(s->name,p1->name);//把学生结构体的班级,学号,姓名放到平均分结构体中
if(n==1) heads=s; else p->next=s;
p=s;//构建平均成绩链表 n++; }
p1=p1->next;//下一个学生 }
p->next=NULL; }
return(heads); }
//######################################## 六
########################################################### //####################################按平均分排名次#####################################################
struct ave *sort(struct ave *heads)//排大小顺序函数 {
struct ave *p1,*p2; p1=p2=heads;
if(heads->next==NULL) return(heads); p2=p2->next; p1->next=NULL; p1=p2;
while(p2->next!=NULL) {
p2=p2->next; p1->next=NULL;
heads=insert(heads,p1); p1=p2; }
heads=insert(heads,p1); return(heads); }
//########################################### 七
##################################################### //########################################按顺序插入
##################################################
struct ave *insert(struct ave *heads,struct ave *charu)//按大小顺序插入(为了排序) {
struct ave *p0,*p1,*p2; int i;//ceshi p1=heads; p0=charu;
if(heads==NULL) {
heads=p0;
p0->next=NULL; } else {
while((p0->studentave
p2=p1;
p1=p1->next; }
if(p0->studentave>=p1->studentave) {
if(heads==p1) heads=p0; else
p2->next=p0; p0->next=p1; } else {
p1->next=p0; p0->next=NULL; } }
return(heads); }
//###################################### 八
############################################################# //################################输出大小顺序的信息#####################################################
void sequence(struct ave *heads)//平均成绩从高到低排序输出 {
struct ave *s,*p1; int i=0,n=1,k=0; s=heads;
system(\ if(heads==NULL) {
printf(\没有平均成绩信息\\n\ return; } else
{heads=sort(heads); system(\ p1=heads; while(p1!=NULL)
{ if(n<=9)
printf(\第0%d名:\\n\输出名次 else
printf(\第%d名:\\n\ printf(\
printf(\班级:%-10d学号:%-16s姓名:%-16s平均成绩:%-7.1f科
目:%-4d\\n\
printf(\----------\\n\
for(i=0;i
printf(\课名:%-10s考试:%-15.1f 平时:%-15.1f 综合成
绩:%-9.1f\\n\;
}
printf(\
printf(\**********\\n\
p1=p1->next;//下一个平均成绩 n++; } } }
//######################################### 九
#########################################################