资源描述:
《【2017年整理】学生管理系统原代码》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、#include#include#include#defineSTUDENTstructstudent#defineLENsizeof(STUDENT)#include#include#include STUDENT{ longnum; charname[5]; intmath; intenglish; intchengxu; intaverage; STUDENT*next;};
2、intn=0; voidmenu() { printf("**************成绩管理系统**************"); printf("t1--成绩输入;t2--显示成绩"); printf("t3--成绩查询;t4--删除成绩"); printf("t5--排列成绩;t6--插入成绩"); printf("t7--在文件中保存成绩;t0--退出"); printf("*****************************************
3、*******"); printf("请选择(0--7):");}charchoice(){ charselect;// while(!_kbhit()); select=getche(); return(select);}STUDENT*create(){ STUDENT*head,*p1,*p2; p1=p2=(STUDENT*)malloc(LEN); scanf("%ld%s%d%d%d",&p1->num,p1->name,&p1->math,&p1->english
4、,&p1->chengxu); p1->average=(p1->math+p1->english+p1->chengxu)/3; head=NULL; while(p1->num!=0) { n++; if(n==1) head=p1; else p2->next=p1; p2=p1; p1=(STUDENT*)malloc(LEN); scanf("%ld%s%d%d%d",&p1->num,p1->name,&p1->math,&p1->english,&p1->chengxu);
5、 p1->average=(p1->math+p1->english+p1->chengxu)/3; } p2->next=NULL; free(p1); return(head);}voidprint(STUDENT*head){ STUDENT*p; p=head; if(head!=NULL) do { printf("%ldt%st%dt%dt%dt%d",p->num,p->name,p->math,p->english,p->chengxu,p->avera
6、ge); p=p->next; }while(p!=NULL);}voidsearch(STUDENT*head,charnam[]){ STUDENT*p5; if(head==NULL) { printf("listnull!"); } p5=head; while(strcmp(p5->name,nam)&&p5->next!=NULL) p5=p5->next; if(strcmp(p5->name,nam)==0) { printf("该同学成绩为:"); printf("学
7、号t姓名t数学t英语t程序t平均分"); printf("%ldt%st%dt%dt%dt%d",p5->num,p5->name,p5->math,p5->english,p5->chengxu,p5->average); }}STUDENT*del(STUDENT*head,longnum){ STUDENT*p6,*p7; if(head==NULL) { printf("listnull!="); return(head); } p6=head; whil
8、e(num!=p6->num&&p6->next!=NULL) { p7=p6; p6=p6->next; } if(num==p6->num) { if(p6==head) head=p6->next; else p7->next=p6->next; printf("delete:%ld",num); n--; } el