学生选课系统C语言程序代码

上传人:cl****1 文档编号:470800032 上传时间:2023-03-13 格式:DOCX 页数:24 大小:34.09KB
返回 下载 相关 举报
学生选课系统C语言程序代码_第1页
第1页 / 共24页
学生选课系统C语言程序代码_第2页
第2页 / 共24页
学生选课系统C语言程序代码_第3页
第3页 / 共24页
学生选课系统C语言程序代码_第4页
第4页 / 共24页
学生选课系统C语言程序代码_第5页
第5页 / 共24页
点击查看更多>>
资源描述

《学生选课系统C语言程序代码》由会员分享,可在线阅读,更多相关《学生选课系统C语言程序代码(24页珍藏版)》请在金锄头文库上搜索。

1、#include#includestructcouse*headl;structstudent*head2;structcouse/课程信息结构体intnuml;charname120;intscore;intnelepeo;/课程已选人数intMelepeo;/课程人数上限structcouse*next;;structstudent/学生信息结构体intnum2;charname220;intnelenum50;/已选课程编号intnelen;/已选课程数量structstudent*next;voidkeyboarda)/录入课程子函数(从键盘录入)structcouse*p1,*p2;

2、N1=0;p1=p2=(structcouse*)malloc(sizeof(structcouse);printf(n课程编号t课程名称t学分t课程人数上限n);scanf(%d%s%d%d”,&p1-num1,p1-name1,&p1-score,&p1-Melepeo);p1-nelepeo=0;head1=NULL;while(p1-num1!=0&p1-num1!=#)N1=N1+1;if(N1=1)head1=p1;elsep2-next=p1;p2=p1;p1=(structcouse*)malloc(sizeof(structcouse);scanf(%d%s%d%d”,&p1

3、-num1,p1-name1,&p1-score,&p1-Melepeo);p1-nelepeo=0;p2-next=NULL;voidinputc()/录入课程主函数inti;printf(n录入课程信息n);printf(n1.从键盘录入n);printf(n2.返回主菜单n);printf(n请选择编号(13):n);scanf(%d,&i);switch(i)case(1):keyboardc();break;case(2):break;voidinsertc(structcouse*incouse)/课程信息增力口子函数structcouse*p0,*p1,*p2;p1=head1;

4、p0=incouse;if(head1=NULL)head1=p0;p0-next=NULL;elsewhile(p0-num1p1-num1)&(p1-next!=NULL)p2=p1;p1=p1-next;if(p0-num1num1)if(head1=p1)head1=p0;elsep2-next=p0;p0-next=p1;elsep1-next=p0;p0-next=NULL;N1=N1+1;voiddelc(intnuml)/课程信息删除子函数structcouse*p1,*p2;if(head1=NULL)printf(n没有课程,无法删除!n);gotoend;p1=head1

5、;while(num1!=p1-num1&p1-next!=NULL)p2=p1;p1=p1-next;if(num1=p1-num1)if(p1=head1)head1=p1-next;elsep2-next=p1-next;printf(n已删除该编号课程!n);N1=N1-1;elseprintf(n无该编号的课程!n);end:;voidmanagement)”课程信息管理主函数structcouse*incouse;inti,num1;printf(n课程管理n);printf(n1.新增课程n);printf(n2.删除课程n);printf(n3.返回主菜单n);printf(n

6、请选择编号(13):n);scanf(%d,&i);switch(i)case(1):incouse=(structcouse*)malloc(sizeof(structcouse);printf(n课程编号t课程名称t学分t课程人数上限n);scanf(%d%s%d%d,&incouse-num1,incouse-name1,&incouse-score,&incouse-Melepeo);incouse-nelepeo=0;insertc(incouse);break;case(2):printf(n请输入要删除课程的编号:n);scanf(%d”,&num1);delc(num1);br

7、eak;case(3):break;voidkeyboards。/录入学生信息子函数(从键盘录入)inti;structstudent*p1,*p2;N2=0;p1=p2=(structstudent*)malloc(sizeof(structstudent);printf(n学生学号t学生姓名n);scanf(%d%s,&p1-num2,p1-name2);p1-nelen=0;for(i=0;inelenumi=0;head2=NULL;while(p1-num2!=0)N2=N2+1;if(N2=1)head2=p1;elsep2-next=p1;p2=p1;p1=(structstud

8、ent*)malloc(sizeof(structstudent);scanf(%d%s,&p1-num2,p1-name2);p1-nelen=0;for(i=0;inelenumi=0;p2-next=NULL;voidinputs()/录入学生信息主函数inti;printf(n录入学生信息n);printf(n1.从键盘录入n);printf(n2.返回主菜单n);printf(n请选择编号(12):n);scanf(%d,&i);switch(i)case(1):keyboards();break;case(2):break;voidinserts(structstudent*inc

9、ouse)/学生信息增加子函数structstudent*p0,*p1,*p2;p1=head2;p0=incouse;if(head2=NULL)head2=p0;p0-next=NULL;elsewhile(p0-num2p1-num2)&(p1-next!=NULL)p2=p1;p1=p1-next;if(p0-num2num2)if(head2=p1)head2=p0;elsep2-next=p0;p0-next=p1;elsep1-next=p0;p0-next=NULL;N2=N2+1;voiddels(intnum2)/学生信息删除子函数structstudent*p1,*p2;

10、if(head2=NULL)printf(n没有该学生信息,无法删除!n);gotoend;p1=head2;while(num2!=p1-num2&p1-next!=NULL)p2=p1;p1=p1-next;if(num2=p1-num2)if(p1=head2)head2=p1-next;elsep2-next=p1-next;printf(n已删除该学生信息!n);N2=N2-1;elseprintf(n无该学号的学生!n);end:;voidmanagements。/学生信息管理主函数structstudent*incouse;inti,num2;printf(n学生信息管理n);p

11、rintf(n1.新增学生信息n);printf(n2.删除学生信息n);printf(n3.返回主菜单n);printf(n请选择编号(13):n);scanf(%d,&i);switch(i)case(1):incouse=(structstudent*)malloc(sizeof(structstudent);incouse-nelen=0;incouse-nelenum0=0;printf(n学生学号t学生姓名n);scanf(%d%s,&incouse-num2,incouse-name2);inserts(incouse);break;case(2):printf(n请输入要删除学

12、生的学号:n);scanf(%d”,&num2);dels(num2);break;case(3):break;voidelect(structstudent*s)/学生选课子函数(进行选课)structcouse*p;intnum1,i;printf(n请输入要选课的编号:n);scanf(%d”,&num1);for(i=0;s-nelenumi!=0;i+);s-nelenumi=num1;(s-nelen)+;p=head1;while(p-num1!=num1)p=p-next;(p-nelepeo)+;voidcheak()/学生选课子函数(查询可选课程)chare;structc

13、ouse*c;structstudent*s;intnum2,i,j=0,t=0;printf(n请输入你的学号:n);scanf(%d”,&num2);s=head2;while(s-num2!=num2&s-next!=NULL)s=s-next;if(s-num2!=num2)printf(n不存在你的信息,请进入主菜单录入你的信息!n);gotoend;c=head1;printf(n你的可选课程编号:n);while(c!=NULL)for(t=0,i=0;s-nelenumi!=0;i+)if(c-num1=s-nelenumi)t=1;if(t=0&(c-nelepeo!=c-Melepeo)pr

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 商业/管理/HR > 营销创新

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号