数据结构课程设计报告-学生宿舍管理系统内容摘要:

qnext=p。 q=p。 } fclose(fp)。 } int Display() /*将文件信息显示出来 */ { Stu *head。 Stu *p。 InitStu(amp。 head)。 Read_from_File(head)。 p=headnext。 system(cls)。 if(!p) 14 { printf(Have no element!)。 printf(\nEnd with 39。 ESC39。 )。 getch()。 return 0。 } printf(\n\t\t****欢迎进入学生宿舍管理系统 ****\n\n\n\n)。 printf(学号 姓名 性别 生日(年 _月 _日) 系别 专业 楼号 宿舍号 床号 \n\n)。 while(p) { printf(%8d%8s%4c%6d%5d%8d%12s%8s%8d%8d%5d\n,pNum,pName,pSex, p,p,p,pDepartment,pSubject, p,p,p)。 p=pnext。 } printf(\nEnd with 39。 ECS39。 )。 getch()。 return 1。 } void Delete() /*删除学生信息 */ { Stu *head。 Stu *p,*q。 char ch,h。 int N。 int Build_num,Room_num,Bed_num。 InitStu(amp。 head)。 Read_from_File(head)。 q=head。 p=headnext。 do { system(cls)。 flushall()。 printf(\n\t\t****欢迎进入学生宿舍管理系统 ****\n)。 printf(\n\n\t\ta. 根据学生学号删除 \n)。 printf(\n\n\t\ \n)。 printf(\n\n\t\t请选择删除方式 :)。 ch=getchar()。 while(1) { if(ch==39。 a39。 ) 15 { printf(\n\n请输入学生学号 :)。 scanf(%d,amp。 N)。 while(p) { if(pNum==N) { qnext=pnext。 free(p)。 p=qnext。 printf(删除成功。 )。 break。 } q=p。 p=pnext。 } if( p==NULL) { printf(\n***Not find the student!***)。 break。 } } else if(ch==39。 b39。 ) { printf(\n\n请输入宿舍信息 (楼号 宿舍 床号 ): )。 scanf(%d %d %d,amp。 Build_num,amp。 Room_num,amp。 Bed_num)。 while(p!=NULL) { if(p==Build_num amp。 amp。 p==Room_num amp。 amp。 p) { qnext=pnext。 free(p)。 p=qnext。 printf(删除成功。 )。 break。 } q=p。 p=pnext。 } if(p==NULL) { printf( Not find the student)。 break。 } } break。 } printf(\n\n****继续 ?Y/N)。 16 h=getch()。 }while(h==39。 Y39。 ||h==39。 y39。 )。 Write_to_File(head)。 } void MidInsert() /*中间插入学生信息 */ { Stu *head。 Stu *p,*q。 char ch。 int N。 InitStu(amp。 head)。 Read_from_File(head)。 q=headnext。 system(cls)。 printf(\n\t\t****欢迎进入学生宿舍管理系统 ****\n)。 flushall()。 do { printf(\n\n\t请输入插入位置 : )。 scanf(%d,amp。 N)。 while(q!=NULL) { p=(Stu *)malloc(sizeof(Stu *))。 if(qNum==N) { printf(\t\t 请输入插入的学生信息 :\n )。 flushall()。 printf(\t 学号 :)。 scanf(%d,amp。 pNum)。 flushall()。 printf(\n\t 姓名 :)。 scanf(%s,pName)。 flushall()。 printf(\n\t 性别 :)。 scanf(%c,amp。 pSex)。 flushall()。 printf(\n\t 生日(年 _月 _日) :)。 scanf(%d_%d_%d,amp。 p,amp。 p,amp。 p)。 17 flushall()。 printf(\n\t 系别 :)。 scanf(%s,pDepartment)。 flushall()。 printf(\n\t 专业 :)。 scanf(%s,pSubject)。 flushall()。 printf(\n\t 楼号 :)。 scanf(%d,amp。 p)。 flushall()。 printf(\n\t 宿舍号 :)。 scanf(%d,amp。 p)。 flushall()。 printf(\n\t 床号 :)。 scanf(%d,amp。 p)。 pnext=qnext。 qnext=p。 break。 } p=q。 q=qnext。 } if(q==NULL) printf(\t\t Not find !)。 Write_to_File(head)。 printf(\t 继续 ?Y/N)。 ch=getch()。 }while(ch==39。 y39。 ||ch==39。 Y39。 )。 } Stu *HeadInsert(Stu *top) { Stu *p。 char ch。 InitStu(amp。 top)。 Read_from_File(top)。 system(cls)。 printf(\n\t\t****欢迎进入学生宿舍管理系统 ****\n)。 flushall()。 do { p=(Stu*)malloc(sizeof(Stu))。 pnext=NULL。 printf(\t\t 请输入插入的学生信息 :\n )。 18 flushall()。 printf(\t 学号 :)。 scanf(%d,amp。 pNum)。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。