C语言课程设计实践报告——《学生选课管理系统》[内附程序源代码].docx_第1页
C语言课程设计实践报告——《学生选课管理系统》[内附程序源代码].docx_第2页
C语言课程设计实践报告——《学生选课管理系统》[内附程序源代码].docx_第3页
C语言课程设计实践报告——《学生选课管理系统》[内附程序源代码].docx_第4页
C语言课程设计实践报告——《学生选课管理系统》[内附程序源代码].docx_第5页
已阅读5页,还剩23页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

c语言大型作业实践报告 计算机1001 制作者:李菁华 张兆丰 秦恒加 2011年6月题目:选修课程管理系统要求:假定有n门选修课,每门课有课程编号、名称、课程性质、总学时、授课学时、实验或上机学时、学分、开课学期等信息。学生可按要求(如总学分不能少于20学分)选课。 课程信息维护,如录入、修改、删除等,课程信息用文件保存。 课程信息浏览输出。 学生选课功能。 查询功能包括:按学分、课程性质、学生等查询。 统计功能。统计各门课程的选修人数。 本系统要有通用性、界面美观、操作方便。要考虑系统安全。课程信息录入系统选修课程信息录入选修课程信息保存主程序目录选择总体设计思路(流程图):学生选课系统课程信息读入学生信息输入选课系统数据保存选修课数据维护系统添加修改删除以word格式输出密码系统密码验证系统权限限制系统 密码对退出程序 密码对选修课程信息查找按各种类型查找 密码错3次以上 具体算法流程设计思路(流程图):主程序目录选择1.学生选课系统;2.选修课程信息输出;3.选修课程信息查找;4.管理员选项;5.退出系统。管理员选项密码验证系统读入系统时间,通过强制转换成unsigned long int型数据作为初始密码用户输入密码(若是管理员会拥有密码钥匙,得出现在的密码,该密码每分钟都会变化)密码正确进入管理员管理界面,密码不正确重新输入密码输入错误3次以上 1 2 3学生选课系统选修课程信息以word2003形式输出返回主菜单选修课程信息查找选修课程信息从文件内读入输入按什么查找1.课程编号;2.课程名;3.课程种类;4.总课时;5.教学课时;6实验课时;7.学分;8.开课学期;9.已选人数。输入查找的关键字从文件内读入的课程信息与关键字逐一对比,完全匹配输出;查找完毕学生信息输入课程信息浏览不选 少于这门 20分 选课系统课选课成功判断学分是否大于20分大于20分结束选课选课信息储存退出程序管理员模块 管理员模块 3目录选择1.学生选课系统;2.选修课程信息管理系统;3.退出系统 1 2 5学生选课系统二级目录选择1.新建选修课程信息;2.管理选修课程信息;3.统计每门课程选择人数;4.选修课程信息输出;5.回到主菜单。 1 2 3 4新建选修课程信息输入选修课程总数按提示顺序输入每门课程详细信息是否修改数据保存返回主菜单显示每门课程已选人数课程信息以word2003格式输出返回主菜单管理选修课程信息输入需要修改的数据类别和组数添加或删除一门选修课输入新数据输入新添加的课程信息输入需要删除的组数完成修改,保存新数据完成添加,保存新数据完成删除,保存新数据返回主菜单退出系统 程序源代码:#include#include#include#includemain()int x,xi,choice2,choice3,choice4,choice8,q=0,filein=0,limit=0,i,num,tonum,tcnum,ecnum,score,term,student,a,io=0,screen=0;/*-变量定义区-,x为现有选修课数量,目前不能超过10,后续与主程序合并时移动到定义区,xi为选修课信息录入循环变量*/char choice1,choice5,choice6,choice7,name10,kind10;int carenum10=0,0,0,0,0,0,0,0,0,0; /*用于统计每门课程选修人数*/ int o,change=0,delatenum,e,u,stui=0,stuc=0;struct elective /*选修课程信息结构体*/int electivenum; /*选修课编号*/char electivename10; /*选修课课名*/char electivekind10; /*选修课性质,暂定考试考查之分*/int totalclassnum; /*总课时*/int techclassnum; /*授课课时*/int expclassnum; /*实验课时*/int credits; /*学分*/int classterm; /*开课学期*/int students; /*此门课选修人数*/;struct muticlass /*学生选择的课程信息结构体*/int stuchoice;int stuclassnum;char stuclassname;struct student /*学生信息结构体*/char stuname10;long stunum;int stucredits;struct muticlass mutichoice20; /*暂定每名学生最多选20门课*/ /*本结构体为嵌套结构体,完善功能时请注意嵌套结构*/;struct student studentcare100; /*暂定最多可以有100名学生选课*/struct elective electivedata10; /*最多10门选修课*/file *electivefp;/*选修课程信息文件指针*/file *stufp; /*学生信息文件指针*/file *outfp; /*课程信息输出文件指针*/file *find;long now,midkey; /*now为密码算法中间变量,midkey为密码算法最终结果*/int chancenum=0,m; /*chancenum为输入密码错我次数计数变量,m为主目录选择判断变量*/unsigned long password,password2;struct tm *timenow; /*timenow为标准系统时间提取指针*/textcolor(white);system(cls);gotoxy(20,12);cprintf(welcome to the elective management system); /*一级主菜单*/gotoxy(1,24);system(pause);t2:system(cls);gotoxy(24,11);cprintf(1.students elective course system);gotoxy(24,12);cprintf(2.elective information output);gotoxy(24,13);cprintf(3.elective course information searching);gotoxy(24,14);cprintf(4.im the administrator!);gotoxy(24,15);cprintf(5.exit the system);gotoxy(24,16);scanf(%d,&choice8);switch(choice8)case 1: limit=0;goto students1;case 2: goto x11;case 3: goto x12;case 4: goto x7;case 5: goto x3;default: system(cls);gotoxy(20,12);cprintf(wrong choice!);gotoxy(1,24);system(pause);goto t2;x7:textcolor(yellow); /*-密码判断模块-*/time(&now);midkey=now;midkey=midkey/100;password=midkey; return2:system(cls);gotoxy(22,15);cprintf(enter 1 to refresh the password.);gotoxy(25,12);cprintf(please enter your passwordn);gotoxy(25,13);scanf(%ld,&password2); /*password2为用户输入的密码变量*/if(chancenum10) /*总课程数小于10判断*/system(cls);gotoxy(12,12);cprintf(up to 10!);gotoxy(1,24);system(pause);goto a1;for(xi=0;xix;xi+) /*课程信息录入*/r1:system(cls); /*课程信息开始录入*/gotoxy(12,11);cprintf(please enter the no.%d elective course numbers,xi+1);gotoxy(12,12);scanf(%d,&electivedataxi.electivenum);if(q=1)goto z4;r2:system(cls);gotoxy(12,11);cprintf(please input the name of the no.%d elective course class,xi+1);gotoxy(12,12);scanf(%s,&electivedataxi.electivename);if(q=1)goto z4;r3:system(cls);gotoxy(12,11);cprintf(please enter the no.%d elective properties,exam or examines,xi+1);gotoxy(12,12);scanf(%s,&electivedataxi.electivekind);if(q=1)goto z4;r4:system(cls);gotoxy(12,11);cprintf(please enter the no.%d elective total class number,xi+1);gotoxy(12,12);scanf(%d,&electivedataxi.totalclassnum);if(q=1)goto z4;r5:system(cls);gotoxy(12,11);cprintf(please enter the no.%d elective lecture class number,xi+1);gotoxy(12,12);scanf(%d,&electivedataxi.techclassnum);if(q=1)goto z4;r6:system(cls);gotoxy(12,11);cprintf(please enter the no.%d elective the experiment class number,xi+1);gotoxy(12,12);scanf(%d,&electivedataxi.expclassnum);if(q=1)goto z4;r7:system(cls);gotoxy(12,11);cprintf(please enter the no.%d elective credits,xi+1);gotoxy(12,12);scanf(%d,&electivedataxi.credits);if(q=1)goto z4;r8:system(cls);gotoxy(12,11);cprintf(please enter the no.%d elective course semesters,xi+1);gotoxy(12,12);scanf(%d,&electivedataxi.classterm);if(q=1)goto z4;if(xi(x-1) system(cls); gotoxy(12,12); cprintf(this elective information recorded success, please enter the next);gotoxy(1,24); system(pause); /*课程信息录入结束*/z4:system(cls); /*课程信息输入正确性判断*/gotoxy(12,12);cprintf(if information recorded correctly?);gotoxy(14,13);cprintf(enter y for yes,n for no);gotoxy(14,14);scanf(%c,&choice1);switch(choice1)case 121: goto z2;case 110: goto z3;default: system(cls);gotoxy(12,12);cprintf(wrong choice!please make it again.);gotoxy(1,24);system(pause);goto z4;z3: /*错误信息定位*/system(cls);gotoxy(8,5);cprintf(what message entry errors?);gotoxy(12,6);cprintf(1.elective course numbers);gotoxy(12,7);cprintf(2.name of elective course class);gotoxy(12,8);cprintf(3.elective properties);gotoxy(12,9);cprintf(4.elective total class number);gotoxy(12,10);cprintf(5.elective lecture class number);gotoxy(12,11);cprintf(6.elective experiment class number);gotoxy(12,12);cprintf(7.elective credits);gotoxy(12,13);cprintf(8.elective course semesters);gotoxy(12,14);cprintf(9.add a elective course lesson.);gotoxy(12,15);cprintf(10.delate a elective course lesson.);gotoxy(12,16);scanf(%d,&choice2); /*错误项目定位*/system(cls);if(choice2=9)goto r9;elseif(choice2=10)goto r10;elsegoto z6;z6:system(cls);gotoxy(12,12);cprintf(which group of curriculum information need to modify?);gotoxy(12,13);scanf(%d,&choice3); /*错误组别定位*/if(choice30) goto z7;else system(cls); gotoxy(12,12); cprintf(wrong group,please enter again);gotoxy(1,24); system(pause); goto z6; z7:xi=choice3-1;switch(choice2) /*错误信息修改*/case 1: q=1;goto r1;case 2: q=1;goto r2;case 3: q=1;goto r3;case 4: q=1;goto r4;case 5: q=1;goto r5;case 6: q=1;goto r6;case 7: q=1;goto r7;case 8: q=1;goto r8;case 9: q=1;goto r9;case 10: q=1;goto r10;default: system(cls);gotoxy(12,12);cprintf(wrong choice.please make it again.);gotoxy(1,24);system(pause);goto z3;z2:if(change=0)goto write1; else remove(elective.dat);electivefp=fopen(elective.dat,w+);goto write1;write1:fprintf(electivefp,%d n,x);for(xi=0;xix;xi+) /*将完善的课程信息以文件的形式保存在磁盘上*/ electivedataxi.students=0;fprintf(electivefp,%d %s %s %d %d %d %d %d %dn,electivedataxi.electivenum,electivedataxi.electivename,electivedataxi.electivekind,electivedataxi.totalclassnum,electivedataxi.techclassnum,electivedataxi.expclassnum,electivedataxi.credits,electivedataxi.classterm,electivedataxi.students);filein=1;z1: system(cls); gotoxy(12,12); cprintf(elective course information input success!);gotoxy(1,24);system(pause); goto return1; /*返回主菜单*/x2:change=1;if(filein=1)goto z3;electivefp=fopen(elective.dat,r+);fscanf(electivefp,%d n,&x);for(xi=0;xi0|delatenumx)for(e=0;ex-delatenum;e+)electivedatadelatenum+e-1=electivedatadelatenum+e;x=x-1;remove(elective.dat);electivefp=fopen(elective.dat,w+);elsesystem(cls);gotoxy(12,12);cprintf(we do not have that group of elective information);gotoxy(1,24);system(pause);goto r10;goto z4;students1:electivefp=fopen(elective.dat,r+); fscanf(electivefp,%d n,&x); for(xi=0;xix;xi+) fscanf(electivefp,%d %s %s %d %d %d %d %d %dn,&electivedataxi.electivenum,&electivedataxi.electivename,&electivedataxi.electivekind,&electivedataxi.totalclassnum,&electivedataxi.techclassnum,&electivedataxi.expclassnum,&electivedataxi.credits,&electivedataxi.classterm,&electivedataxi.students); stufp=fopen(stu.dat,r+);return4:system(cls);gotoxy(12,12);cprintf(please enter your name);gotoxy(12,13);scanf(%s,&studentcarestui.stuname);system(cls);gotoxy(12,12);cprintf(please enter your student id);gotoxy(12,13);scanf(%ld,&studentcarestui.stunum);care2:system(cls);gotoxy(3,2);cprintf(existing elective);for(u=0;u0) for(xi=0;xistuc+1;xi+) if(choice4=studentcarestui.mutichoicexi.stuclassnum) system(cls); gotoxy(12,12); cprintf(connot repeat courses!);gotoxy(1,24); system(pause); goto care2; carenumchoice4-1+;electivedatachoice4-1.students=carenumchoice4-1;studentcarestui.mutichoicestuc.stuchoice=choice4;studentcarestui.stucredits=studentcarestui.stucredits+electivedatachoice4-1.credits;studentcarestui.mutichoicestuc.stuclassnum=electivedatachoice4-1.electivenum;studentcarestui.mutichoicestuc.stuclassname=electivedatachoice4-1.electivename;x10:system(cls);gotoxy(12,12);cprintf(course whether end? enter y for yes,n for no);gotoxy(12,13);scanf(%c,&choice6);switch(choice6)case 121: goto x9;case 110: stuc+;goto care2;default: system(cls);gotoxy(12,12);cprintf(wrong choice!);gotoxy(1,24);system(pause);goto x10;x9:if(studentcarestui.stucredits20)system(cls);gotoxy(12,12);cprintf(attention!total cred

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论