学生选课系统代码(15页).doc
《学生选课系统代码(15页).doc》由会员分享,可在线阅读,更多相关《学生选课系统代码(15页).doc(15页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、-#include #includeint N1,N2,kk1,kk2,kk3;struct couse * head1;struct student * head2;struct couseint num1;char name120;int score;int nelepeo;int Melepeo;struct couse * next;struct studentint num2;char name220;int nelenum50;int nelen;struct student * next;void Ms()for(kk1=0;kk11100;kk1+)for(kk2=0;kk21
2、200;kk2+)for(kk3=0;kk3num1,p1-name1,&p1-score,&p1-Melepeo);p1-nelepeo=0;head1=NULL;while(p1-num1!=0)N1=N1+1;if(N1=1)head1=p1;else p2-next=p1;p2=p1;p1=(struct couse * )malloc(sizeof(struct couse);scanf(%d%s%d%d,&p1-num1,p1-name1,&p1-score,&p1-Melepeo);p1-nelepeo=0;p2-next=NULL;void filec()FILE * fp;c
3、har filepath20; struct couse *p1,*p2;N1=0;printf(输入要读入的文件路径:);getchar();gets(filepath); if(fp=fopen(filepath,r)=NULL) printf(找不到%s文件!n,filepath); exit(0); p1=p2=(struct couse*)malloc(sizeof(struct couse);fscanf(fp,%d%s%d%d%d,&p1-num1,p1-name1,&p1-score,&p1-nelepeo,&p1-Melepeo);head1=NULL;while(!feof
4、(fp) N1=N1+1;if(N1=1)head1=p1;else p2-next=p1;p2=p1;p1=(struct couse * )malloc(sizeof(struct couse);fscanf(fp,%d%s%d%d%d,&p1-num1,p1-name1,&p1-score,&p1-nelepeo,&p1-Melepeo); p2-next=NULL;void inputc() int i;printf(ttt录入课程信息n); printf(n1.从键盘录入n);printf(2.从文件录入n);printf(3.返回主菜单n);printf(请选择(13):n); s
5、canf(%d,&i);switch(i)case(1):keyboardc();break;case(2):filec();break;case(3):break;void insertc(struct couse *incouse)struct couse *p0,*p1,*p2;p1=head1;p0=incouse;if(head1=NULL)head1=p0; p0-next=NULL;elsewhile(p0-num1 p1-num1) & (p1-next!=NULL) p2=p1; p1=p1-next; if(p0-num1 num1) if(head1=p1) head1=
6、p0; else p2-next=p0; p0-next=p1; else p1-next=p0;p0-next=NULL;N1=N1+1;void delc(int num1)struct couse *p1,*p2;if(head1=NULL)printf(n没有课程,无法删除!n);goto end; p1=head1; while(num1!=p1-num1 & p1-next!=NULL) p2=p1; p1=p1-next;if(num1=p1-num1)if(p1=head1) head1=p1-next;else p2-next=p1-next;printf(已删除该编号课程!
7、n);N1=N1-1;else printf(无该编号的课程!n);end:;void managementc()struct couse * incouse;int i,num1;printf(ttt课程管理n);printf(1.新增课程n);printf(2.删除课程n);printf(3.返回主菜单n);printf(请选择(13):n);scanf(%d,&i);switch(i)case(1):incouse=(struct couse *)malloc(sizeof(struct couse);printf(课程编号t课程名称t学分t课程人数上限n); scanf(%d%s%d%
8、d,&incouse-num1,incouse-name1,&incouse-score,&incouse-Melepeo);incouse-nelepeo=0;insertc(incouse);break;case(2):printf(请输入要删除课程的编号:n);scanf(%d,&num1);delc(num1);break;case(3):break;void keyboards()int i;struct student *p1,*p2;N2=0;p1=p2=(struct student *)malloc(sizeof(struct student);printf(学生学号t学生姓
9、名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;else p2-next=p1;p2=p1;p1=(struct student * )malloc(sizeof(struct student);scanf(%d%s,&p1-num2,p1-name2);p1-nelen=0;for(i=0;inelenumi=0;p2-next=NULL;void files()int i=0;FILE * fp;char
10、 filepath20; struct student *p1,*p2;N2=0;printf(输入要读入的文件路径:);getchar();gets(filepath); if(fp=fopen(filepath,r)=NULL) printf(找不到%s文件!n,filepath); exit(0); p1=p2=(struct student*)malloc(sizeof(struct student);fread(p1,sizeof(struct student),1,fp);head2=NULL;while(!feof(fp)i=0;N2=N2+1;if(N2=1)head2=p1;
11、else p2-next=p1;p2=p1;p1=(struct student * )malloc(sizeof(struct student);fread(p1,sizeof(struct student),1,fp); p2-next=NULL;void inputs()int i;printf(ttt录入学生信息n);printf(n1.从键盘录入n);printf(2.从文件录入n);printf(3.返回主菜单n);printf(请选择(13):n);scanf(%d,&i);switch(i)case(1):keyboards();break;case(2):files();br
12、eak;case(3):break;void inserts(struct student * incouse)struct student *p0,*p1,*p2;p1=head2;p0=incouse;if(head2=NULL)head2=p0;p0-next=NULL;elsewhile(p0-num2 p1-num2) & (p1-next!=NULL)p2=p1;p1=p1-next;if(p0-num2 num2)if(head2=p1) head2=p0;else p2-next=p0;p0-next=p1;elsep1-next=p0;p0-next=NULL;N2=N2+1
13、;void dels(int num2)struct student *p1,*p2;if(head2=NULL)printf(n没有该学生信息,无法删除!n);goto end;p1=head2;while(num2!=p1-num2 & p1-next!=NULL)p2=p1;p1=p1-next;if(num2=p1-num2)if(p1=head2) head2=p1-next;else p2-next=p1-next;printf(已删除该学生信息!n);N2=N2-1;else printf(无该学号的学生!n);end:;void managements()struct stud
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 学生 选课 系统 代码 15
限制150内