预览加载中,请您耐心等待几秒...
1/10
2/10
3/10
4/10
5/10
6/10
7/10
8/10
9/10
10/10

亲,该文档总共26页,到这已经超出免费预览范围,如果喜欢就直接下载吧~

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

#include<stdio.h>#include<stdlib.h>structcouse*head1;structstudent*head2;structcouse//课程信息结构体{intnum1;charname1[20];intscore;intnelepeo;//课程已选人数intMelepeo;//课程人数上限structcouse*next;};structstudent//学生信息结构体{intnum2;charname2[20];intnelenum[50];//已选课程编号intnelen;//已选课程数量structstudent*next;};voidkeyboardc()//录入课程子函数(从键盘录入){structcouse*p1,*p2;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->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请选择编号(1~3):\n");scanf("%d",&i);switch(i){case(1):keyboardc();break;case(2):break;}}voidinsertc(structcouse*incouse)//课程信息增加子函数{structcouse*p0,*p1,*p2;p1=head1;p0=incouse;if(head1==NULL){head1=p0;p0->next=NULL;}else{while((p0->num1>p1->num1)&&(p1->next!=NULL)){p2=p1;p1=p1->next;}if(p0->num1<=p1->num1){if(head1==p1)head1=p0;elsep2->next=p0;p0->next=p1;}else{p1->next=p0;p0->next=NULL;}}N1=N1+1;}voiddelc(intnum1)//课程信息删除子函数{structcouse*p1,*p2;if(head1==NULL){printf("\n没有课程,无法删除!\n");gotoend;}p1=head1;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:;}voidmanagementc()//课程信息管理主函数{structcouse*incouse;inti,num1;printf("\n课程管理\n");printf("\n1.新增课程\n");printf("\n2.删除课程\n");printf("\n3.返回主菜单\n");printf("\n请选择编号(1~3):\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);d