网站大量收购独家精品文档,联系QQ:2885784924

学生成绩系统c语言描述.doc

  1. 1、本文档共21页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
学生成绩系统c语言描述

#include malloc.h #include stdio.h #include stdlib.h #define LEN sizeof(struct scorenode) #define DEBUG #include string.h struct scorenode {int number;/*学号*/ char name[10];/*姓名*/ float yuwen;/*语文成绩*/ float yingyu;/*英语成绩*/ float shuxue;/*数学成绩 */ struct scorenode *next; }; typedef struct scorenode score; int n,k;/*n,k为全局变量,本程序中的函数均可以使用它*/ /*==============================================================================================*/ score *creat2311(void) /*函数creat2311,功能:创建链表,此函数带回一个指向链表头的指针*/ { score*head; score *p1,*p2,*p3,*max; int i,j; float fen; char t[10]; n=0; p1=p2=p3=(score *)malloc(LEN);head=p3; /*开辟一个新单元*/ printf(请输入学生资料,输0退出!\n); repeat1: printf(请输入学生学号(学号应大于0):);/*输入学号,学号应大于0*/ scanf(%d,p1-number); while(p1-number0) {getchar(); printf(输入错误,请重新输入学生学号:); scanf(%d,p1-number);} /*输入学号为字符或小于0时,程序报错,提示重新输入学号*/ if(p1-number==0) goto end;/*当输入的学号为0时,转到末尾,结束创建链表*/ else { p3=head; if(n0) {for(i=0;in;i++) {if(p1-number!=p3-number) p3=p3-next; else {printf(学号重复,请重输!\n); goto repeat1; /*当输入的学号已经存在,程序报错,返回前面重新输入*/ } } } } printf(请输入学生姓名:); scanf(%s,p1-name);/*输入学生姓名*/ printf(请输入语文成绩(0~100):);/*输入语文成绩,成绩应在0-100*/ scanf(%f,p1-yuwen); while(p1-yuwen0||p1-yuwen100) {getchar(); printf(输入错误,请重新输入语文成绩);/*输入错误,重新输入语文成绩直到正确为止*/ scanf(%f,p1-yuwen);} printf(请输入英语成绩(0~100):);/*输入英语成绩,成绩应在0-100*/ scanf(%f,p1-yingyu); while(p1-yingyu0||p1-yingyu100) {getchar(); printf(输入错误,请重新输入英语成绩);/*输入错误,重新输入英语成绩直到正确为止*/ scanf(%f,p1-yingyu);} printf(请输入数学成绩(0~100):);/*输入数学成绩,成绩应在0-100*/ scanf(%f,p1-shuxue); while(p1-shuxue0||p1-shuxue100) {getchar(); printf(输入错误,请重新输入数学成绩); scanf(%f,p1-shuxue);}/*输入错误,重新输入数学成绩直到正确为止*/ head=NULL; while(p1-number!=0) { n=n+1; if(n==1) head=p1; else p2-next=p1; p2=p1; p1=(score *)malloc(LEN); printf(请输入学生资料,输0退出!\n); repeat2:printf(请输入学生学号(学号应大于0):);

文档评论(0)

ligennv1314 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档