学生成绩排序与平均分计算利用c语言链表创建插入删除.docVIP

  • 9
  • 0
  • 约5.79万字
  • 约 9页
  • 2017-08-23 发布于河南
  • 举报

学生成绩排序与平均分计算利用c语言链表创建插入删除.doc

学生成绩排序与平均分计算利用c语言链表创建插入删除

#includestdio.h #includemalloc.h #define NULL 0 #define LEN sizeof(struct student) struct student { long num; float score; struct student *next; }; int n; struct student *creat(void)//创建链表 { struct student *head; struct student *p1,*p2; n=0; p1=p2=(struct student*)malloc(LEN); scanf(%ld,%f,p1-num,p1-score); head=NULL; while(p1-num!=0) { n=n+1; if(n==1)head=p1; else p2-next=p1; p2=p1; p1=(struct student *)malloc(LEN); scanf(%ld,%f,p1-num,p1-score); } p2-next=NULL; return(head);//带回链表的头指针 } void print(struct student *head)//输出链表 { struct student *p; printf(\nNow,ther

文档评论(0)

1亿VIP精品文档

相关文档