学生选修课程系统设计 源程序清单

合集下载

学生选课系统(详细设计说明书)

学生选课系统(详细设计说明书)
3.12测试计划13
3.13尚未解决的问题114
4程序2(标识符)设计说明114
详细设计说明书
1
1.1
为了更好的描述软件结构以及系统各组成成分之间的相互关系,因此撰写详
细设计说明书。
1.2
a•待开发的软件系统的名称:大连交通大学学生选课系统;
b•本系统主要为方便广大学选课,避免选课高峰期选不上等问题;
{
printf("找不到%s文件!\n",);
exit(0);
}
p1=p2=(struct couse*)malloc(sizeof(struct couse));
fsca nf(fp,"%d%s%d%d%d", &p1-> num1,p1-> namel,&p1->score,
&p1- >n elepeo,&p1->Melepeo);
{
int nu ml;
char name1[20];
int score;
int n elepeo;//课程已选人数
int Melepeo;//课程人数上限
struct couse * n ext;
};
struct stude nt//学生信息结构体
{
int nu m2;
char name2[20];
c.本系统的受益人为:老师、学生和系统管理人员。
1.3
详见概要设计说明书。
1.4
【1】 张海藩,软件工程导论【M】北京:清华大学出版社2008年2月第五版
【2】 王珊、萨师煊,数据库系统概论【M】北京:高等教育出版社2006年5月第四版
2

C++程序设计源代码 学生选课系统

C++程序设计源代码 学生选课系统
编号的课程,如果存在则提示重新输入,否则将该课程按照顺序插入到相 应位置 5)删除一门课程的基本信息,通过输入课程编号,首先查找是否存在该课程 编号的课程,如果存在则将该课程删除,否则给出提示信息,提示该课程 不存在 6)对课程信息进行修改。 7)选修一门课程,需要给出学号和课程编号,如果课程编号不存在则重新输 入,直到输入正确为止,并将学号和相应的课程编号存入 SelectInfo.txt 文件中 8)查看所选课程。
I
目录
第一章 设计题目的内容、任务及具体要求 ..................................1 第二章 总体设计思路 ....................................................2
2.1 程序功能 ........................................................... 2 2.2 模块关系 ........................................................... 2 2.3 总体框图 ............................................................ 3 第三章 功能模块的具体设计 ..............................................4 3.1 主函数模块的设计 ................................................... 4 3.2 显示课程信息模块的设计 ............................................. 7 3.3 查询模块模块的设计 ................................................. 8 3.4 增加模块的设计 ..................................................... 9 3.5 删除模块模块的设计 ................................................ 13 3.6 修改模块模块的设计 ................................................ 14 3.7 选课模块的设计 .................................................... 15 3.8 显示选课情况模块的设计 ............................................. 17 第四章 功能模块的调试及测试 ...........................................18 4.1 登陆界面和主菜单界面的显示 ........................................ 18 4.2 查询所有课程信息的显示结果 ........................................ 19 4.3 查询单个课程信息的显示结果 ........................................ 19 4.4 添加课程信息的显示结果 ............................................ 20 4.5 删除和修改课程信息的显示结果 ...................................... 20 4.6 选课的显示结果 .................................................... 21 4.7 查询选课情况的显示结果 ............................................ 22 4.8 退出 .............................................................. 22 总结 ..................................................................23 致 谢 ................................................................24 参考资料:............................................................. 25 附程序清单............................................................. 26

C语言学生选修课程系统设计

C语言学生选修课程系统设计

《高级语言程序设计》课程设计说明书设计题目:学生选修课程系统设计目录1.设计目的…………………….p22 .总体设计……………………p33.详细设计…………………….p44.调试与测试………………….p55.源程序清单与执行结果…….p66.建议和体会………………….p21一.设计目的(1)基本掌握面向过程程序设计的基本思路和方法;(2)达到熟练掌握C语言的基本知识和技能;(3)能够利用所学的基本知识和技能,解决简单的程序设计问题程序功能:(1)输入信息,密码保护(2)浏览信息(3)查询信息,提供两种查询方式(4)统计选课情况(5)进入选课操作(6)退出选课系统二.总体设计设计的流程图如下三、详细设计1、输入初始的课程信息:课程信息用文件保存,包括课程编号,课程名称,课程性质,总学时,授课学时,实验或上机学时,学分,开课学期等相关信息。

在输入课程信息前要先输入管理员密码,从而限制权限;2、浏览模块:按照指示就可以找到课程编号,课程名称,课程性质,总学时,授课学时,实验或上机学时,学分,开课学期等相关信息;3、查询模块:按照指示可以选择通过学分查询信息,或者选择课程性质来查询信息;4、选择模块:通过输入学号和课程编号来选择所修课程,并有统计功能;5、查阅模块:选择主菜单的选项,可以了解统计所选课程的人数;6、退出模块:在主菜单选择“0”退出选课系统。

四:调试与测试问题一、查询模块:其中包括课程编号,课程名称,课程性质,总学时,授课学时,实验或上机学时,学分,开课学期等相关信息;当输入学分或者课程性质后,系统进行判断时,提示“输入错误!请重新输入!”解决办法及步骤:1、浏览所有课程中的学分是否为你所输入的值。

2、浏览所有课程中的课程性质是否有存在你所输入的值。

3、输出用于循环检查语句中的课程,发现乱码。

4、仔细分析乱码的原因,最后发现是变量的类型错误,错将课程性质的结构体指针变量定义为了其他类型的指针变量。

C课程设计学生选课系统设计

C课程设计学生选课系统设计

目录1系统需求分析................................................................................................ 错误!未定义书签。

2总体设计........................................................................................................ 错误!未定义书签。

3具体设计........................................................................................................ 错误!未定义书签。

4界面设计与各功能模块实现........................................................................ 错误!未定义书签。

5 系统调试....................................................................................................... 错误!未定义书签。

6 实验心得体会............................................................................................... 错误!未定义书签。

7附: 源程序251系统需求分析(1)、本系统是针对高校学生的选修课程而设计, 通过本系统高校学生可以很方便地进行自由选课。

重要的问题描述是(功能规定): n门课程, 每门课程有课程编号, 课程名称, 课程性质, 总学时, 授课学时, 实验或上机学时, 学分, 开课学期等信息, 学生可按规定(如总学分不得少于60)自由选课。

C语言课程设计实践报告——《学生选课管理系统》[内附程序源代码]

C语言课程设计实践报告——《学生选课管理系统》[内附程序源代码]

C语言大型作业实践报告计算机1001制作者:李菁华张兆丰秦恒加2011年6月题目:选修课程管理系统要求:假定有N门选修课,每门课有课程编号、名称、课程性质、总学时、授课学时、实验或上机学时、学分、开课学期等信息。

学生可按要求(如总学分不能少于20学分)选课。

▪课程信息维护,如录入、修改、删除等,课程信息用文件保存。

▪课程信息浏览—输出。

▪学生选课功能。

▪查询功能包括:按学分、课程性质、学生等查询。

▪统计功能。

统计各门课程的选修人数。

▪本系统要有通用性、界面美观、操作方便。

要考虑系统安全。

具体算法流程设计思路(流程图):程序源代码:#include<stdio.h>#include<time.h>#include<string.h>#include<conio.h>main(){intx,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,name[10],kind[10];int carenum[10]={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 electivename[10]; /*选修课课名*/char electivekind[10]; /*选修课性质,暂定考试考查之分*/int totalclassnum; /*总课时*/int techclassnum; /*授课课时*/int expclassnum; /*实验课时*/int credits; /*学分*/int classterm; /*开课学期*/int students; /*此门课选修人数*/};struct muticlass /*学生选择的课程信息结构体*/{int stuchoice;int stuclassnum;char stuclassname;};struct student /*学生信息结构体*/{char stuname[10];long stunum;int stucredits;struct muticlass mutichoice[20]; /*暂定每名学生最多选20门课*/ /*本结构体为嵌套结构体,完善功能时请注意嵌套结构*/};struct student studentcare[100]; /*暂定最多可以有100名学生选课*/struct elective electivedata[10]; /*最多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.I'm 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("wrongchoice");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 password\n");gotoxy(25,13);scanf("%ld",&password2); /*password2为用户输入的密码变量*/ if(chancenum<4) /*用户输入密码错误次数判断*/{if(password2==password){limit=1;goto x4;}else{if(password2==1){goto x7;}else{system("cls");gotoxy(22,12);textcolor(RED);cprintf("password error");gotoxy(18,13);cprintf("please enter the right password");gotoxy(20,14);cprintf("You have only %d chances",3-chancenum);gotoxy(1,24);system("pause");if(chancenum==3) /*连续4次输入错误密码判断*/{goto x6;}chancenum=chancenum+1;goto return2;}}}x6:system("cls");gotoxy(20,12);cprintf(" Sorry,you have null chance.");gotoxy(1,24);goto x5; /*-----密码判断模块结束-----*/x4:switch(limit){case 0: textcolor(YELLOW);goto students1;case 1: textcolor(GREEN);goto t3;default: textcolor(RED);system("cls");gotoxy(20,12);cprintf("None Limited");gotoxy(1,24);system("pause");textcolor(WHITE);goto t2;}t3:textcolor(GREEN); /*-----主程序开始-----*/system("cls");gotoxy(20,12);cprintf("Welcome to the Elective management system"); /*一级主菜单*/gotoxy(1,24);system("pause");return1:system("cls");gotoxy(24,3);cprintf("Elective management system"); /*选修课管理系统*/gotoxy(24,11);cprintf("1.Students elective course system."); /*学生选课系统*/gotoxy(24,12);cprintf("2.Elective course maintenance system."); /*课程信息维护系统*/gotoxy(24,13);cprintf("3.Exit the system."); /*退出系统*/gotoxy(24,14);scanf("%d",&o);switch(o){case 1: goto students1;case 2: goto electivemans1;case 3: goto x3;default: system("cls");gotoxy(12,12);cprintf("error choice,please make your choice again\n");gotoxy(1,24);system("pause");goto return1;}electivemans1:system("cls");change=0;gotoxy(24,3);cprintf("Elective management system"); /*二级主菜单*/gotoxy(24,11);cprintf("1.New elective database"); /*新建选修课程信息*/gotoxy(24,12);cprintf("2.Maintain elective database"); /*修改选修课程信息*/gotoxy(24,13);cprintf("3.Show the number of statistical electives"); /*统计每门课程选修人数*/gotoxy(24,14);cprintf("4.Elective information output"); /*课程信息输出*/gotoxy(24,15);cprintf("5.Return to the main menu"); /*返回主菜单*/gotoxy(24,16);scanf("%d",&m);switch(m) /*主目录跳转判断*/{case 1: goto x1;case 2: goto x2;case 3: goto x8;case 4: goto x11;case 5: goto return1;default: system("cls");gotoxy(12,12);cprintf("error choice,please make your choice again\n");gotoxy(1,24);system("pause");goto electivemans1;}x3:system("cls");gotoxy(25,12);cprintf("Thanks for using thissystem");gotoxy(1,24);goto x5;x1:electivefp=fopen("elective.dat","w+"); /*-----选修课程信息新建模块-----*/ if((electivefp=fopen("elective.dat","w+"))==NULL){gotoxy(12,12);cprintf("connot open this file");gotoxy(11,13);cprintf("Please debug this program");gotoxy(12,17);system("pause");goto z1;}system("cls");gotoxy(12,12);cprintf("Please according to clew input elective course information");gotoxy(1,24);system("pause");a1:system("cls");gotoxy(12,12);cprintf("Please input the elective quantity,Up to 10."); /*输入此次录入选修课程门数*/gotoxy(14,13);scanf("%d",&x); /*输入选修课总课程数*/if(x>10) /*总课程数小于10判断*/{system("cls");gotoxy(12,12);cprintf("Up to 10");gotoxy(1,24);system("pause");goto a1;}for(xi=0;xi<x;xi++) /*课程信息录入*/{r1:system("cls"); /*课程信息开始录入*/gotoxy(12,11);cprintf("Please enter the No.%d elective course numbers",xi+1);gotoxy(12,12);scanf("%d",&electivedata[xi].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",&electivedata[xi].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",&electivedata[xi].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",&electivedata[xi].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",&electivedata[xi].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",&electivedata[xi].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",&electivedata[xi].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",&electivedata[xi].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 choicePlease 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(" 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;}else{goto z6;}z6:system("cls");gotoxy(12,12);cprintf("Which group of curriculum information need to modify?"); gotoxy(12,13);scanf("%d",&choice3); /*错误组别定位*/if(choice3<x+1&&choice3>0){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;xi<x;xi++) /*将完善的课程信息以文件的形式保存在磁盘上*/{electivedata[xi].students=0;fprintf(electivefp,"%d %s %s %d %d %d %d %d %d\n",electivedata[xi].electivenu m,electivedata[xi].electivename,electivedata[xi].electivekind,electivedata[xi].totalcla ssnum,electivedata[xi].techclassnum,electivedata[xi].expclassnum,electivedata[xi].cr edits,electivedata[xi].classterm,electivedata[xi].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;xi<x;xi++){fscanf(electivefp,"%d %s %s %d %d %d %d %d %d\n",&electivedata[xi].electiven um,&electivedata[xi].electivename,&electivedata[xi].electivekind,&electivedata[xi].t otalclassnum,&electivedata[xi].techclassnum,&electivedata[xi].expclassnum,&electiv edata[xi].credits,&electivedata[xi].classterm,&electivedata[xi].students);}goto z3;r9:x=x+1;system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective course numbers",x);gotoxy(12,12);scanf("%d",&electivedata[x-1].electivenum);system("cls");gotoxy(12,11);cprintf("Please input the name of the No.%d elective course class",x);gotoxy(12,12);scanf("%s",&electivedata[x-1].electivename);system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective properties,\"exam\" or \"examines\"",x);gotoxy(12,12);scanf("%s",&electivedata[x-1].electivekind);system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective total class number",x);gotoxy(12,12);scanf("%d",&electivedata[x-1].totalclassnum);system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective lecture class number",x);gotoxy(12,12);scanf("%d",&electivedata[x-1].techclassnum);system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective the experiment class number",x); gotoxy(12,12);scanf("%d",&electivedata[x-1].expclassnum);system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective credits",x);gotoxy(12,12);scanf("%d",&electivedata[x-1].credits);system("cls");gotoxy(12,11);cprintf("Please enter the No.%d elective course semesters",x);gotoxy(12,12);scanf("%d",&electivedata[x-1].classterm);goto z4;r10:system("cls");gotoxy(12,12);cprintf("Which group of elective do you want to delate?");gotoxy(12,13);scanf("%d",&delatenum);if(delatenum>0||delatenum<x){for(e=0;e<x-delatenum;e++){electivedata[delatenum+e-1]=electivedata[delatenum+e];}x=x-1;remove("elective.dat");electivefp=fopen("elective.dat","w+");}else{system("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;xi<x;xi++){fscanf(electivefp,"%d %s %s %d %d %d %d %d %d\n",&electivedata[xi].electivenum, &electivedata[xi].electivename,&electivedata[xi].electivekind,&electivedata[xi].total classnum,&electivedata[xi].techclassnum,&electivedata[xi].expclassnum,&electiveda ta[xi].credits,&electivedata[xi].classterm,&electivedata[xi].students);}stufp=fopen("stu.dat","r+");return4:system("cls");gotoxy(12,12);cprintf("Please enter your name");gotoxy(12,13);scanf("%s",&studentcare[stui].stuname);system("cls");gotoxy(12,12);cprintf("Please enter your student ID");gotoxy(12,13);scanf("%ld",&studentcare[stui].stunum);care2:system("cls");gotoxy(3,2);cprintf("Existing elective");for(u=0;u<x;u++){gotoxy(5,u+3);cprintf("%d.num:%dname:%s\n",u+1,electivedata[u].electivenum,electivedata[u].electivename);}gotoxy(5,x+4);cprintf("Which are you interested?");gotoxy(5,x+5);scanf("%d",&choice4);return3:system("cls");gotoxy(3,2);cprintf("Elective information");gotoxy(4,4);cprintf("Num:%d",electivedata[choice4-1].electivenum);gotoxy(4,5);cprintf("Name:%s",electivedata[choice4-1].electivename);gotoxy(4,6);cprintf("Kind:%s",electivedata[choice4-1].electivekind);gotoxy(4,7);cprintf("Total class:%d",electivedata[choice4-1].totalclassnum);gotoxy(4,8);cprintf("Tech class:%d",electivedata[choice4-1].techclassnum);gotoxy(4,9);cprintf("Exp class:%d",electivedata[choice4-1].expclassnum);gotoxy(4,10);cprintf("Credits:%d",electivedata[choice4-1].credits);gotoxy(4,11);cprintf("Class term:%d",electivedata[choice4-1].classterm);gotoxy(4,14);cprintf("Sure to choose this course? enter \"y\" for yes,\"n\" for no");gotoxy(4,15);scanf("%c",&choice5);switch(choice5){case 121: goto care1;case 110: goto care2;default: system("cls");gotoxy(12,12);cprintf("wrong choice");goto return3;}care1:if(stuc>0){for(xi=0;xi<stuc+1;xi++){if(choice4==studentcare[stui].mutichoice[xi].stuclassnum){system("cls");gotoxy(12,12);cprintf("Connot repeat courses");gotoxy(1,24);system("pause");goto care2;}}}carenum[choice4-1]++;electivedata[choice4-1].students=carenum[choice4-1];studentcare[stui].mutichoice[stuc].stuchoice=choice4;studentcare[stui].stucredits=studentcare[stui].stucredits+electivedata[choice4-1 ].credits;studentcare[stui].mutichoice[stuc].stuclassnum=electivedata[choice4-1].elective num;studentcare[stui].mutichoice[stuc].stuclassname=electivedata[choice4-1].electiv ename;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("wrongchoice");gotoxy(1,24);system("pause");goto x10;}x9:if(studentcare[stui].stucredits<20){system("cls");gotoxy(12,12);cprintf("Attention!Total credits less than 20!");gotoxy(1,24);system("pause");goto x10;}else{remove("stu.dat");stufp=fopen("stu.dat","a+");fprintf(stufp,"%d \n",stui);system("cls");gotoxy(12,12);cprintf("Elective success!");gotoxy(1,24);system("pause");return6:system("cls");gotoxy(12,12);cprintf("If others need courses? enter \"y\" for yes,\"n\" for no");gotoxy(12,13);scanf("%c",&choice7);switch(choice7){case 121: stui++;goto return4;case 110: goto return5;default: system("cls");gotoxy(12,12);cprintf("wrong choice");gotoxy(1,24);system("pause");goto return6;}return5: for(u=0;u<stui+1;u++){fprintf(stufp,"%s %ld %d\n",studentcare[u].stuname,studentcare[u].stunum,studentcare[u].stucredits);for(xi=0;xi<stuc+1;xi++){fprintf(stufp,"%d %d %s\n",studentcare[u].mutichoice[xi].stuchoice,studentcare[u].mutichoice[xi].stuclassnu m,studentcare[u].mutichoice[xi].stuclassname);}}remove("elective.dat");electivefp=fopen("elective.dat","w+");fprintf(electivefp,"%d \n",x);for(xi=0;xi<x;xi++) /*将完善的课程信息以文件的形式保存在磁盘上*/{fprintf(electivefp,"%d %s %s %d %d %d %d %d %d\n",electivedata[xi].electivenum,el ectivedata[xi].electivename,electivedata[xi].electivekind,electivedata[xi].totalclassnu m,electivedata[xi].techclassnum,electivedata[xi].expclassnum,electivedata[xi].credits ,electivedata[xi].classterm,electivedata[xi].students);}switch(limit){case 1: goto return1;case 0: goto t2;default: goto t2;}}}x8:electivefp=fopen("elective.dat","r+");fscanf(electivefp,"%d \n",&x);for(xi=0;xi<x;xi++){fscanf(electivefp,"%d %s %s %d %d %d %d %d %d\n",&electivedata[xi].electivenum, &electivedata[xi].electivename,&electivedata[xi].electivekind,&electivedata[xi].total classnum,&electivedata[xi].techclassnum,&electivedata[xi].expclassnum,&electiveda ta[xi].credits,&electivedata[xi].classterm,&electivedata[xi].students);}system("cls");gotoxy(3,4);cprintf("Elective toll");for(u=0;u<x;u++){gotoxy(3,u+6);cprintf("%s : %d",electivedata[u].electivename,electivedata[u].students);}gotoxy(1,18);system("pause");goto electivemans1;x11:system("cls"); /*-----查找模块-----*/electivefp=fopen("elective.dat","r+");fscanf(electivefp,"%d \n",&x);for(xi=0;xi<x;xi++){fscanf(electivefp,"%d %s %s %d %d %d %d %d %d\n",&electivedata[xi].electivenum, &electivedata[xi].electivename,&electivedata[xi].electivekind,&electivedata[xi].total classnum,&electivedata[xi].techclassnum,&electivedata[xi].expclassnum,&electiveda ta[xi].credits,&electivedata[xi].classterm,&electivedata[xi].students);}outfp=fopen("electiveinformation.doc","w+");fprintf(outfp,"选修课程信息\n\n\n\n");for(xi=0;xi<x;xi++){fprintf(outfp,"课程编号:%d \n课程名:%s \n课程种类:%s \n总课时:%d \n教学课时:%d \n实验课时:%d \n学分:%d \n开课学期:%d \n已选人数:%d\n\n\n",electivedata[xi].electivenum,electivedata[xi].electivename,electivedat a[xi].electivekind,electivedata[xi].totalclassnum,electivedata[xi].techclassnum,electiv edata[xi].expclassnum,electivedata[xi].credits,electivedata[xi].classterm,electivedata [xi].students);}switch(limit){case 1: goto electivemans1;case 0: goto t2;default: goto t2;}x12:{find=fopen("elective.dat","r+");fscanf(find,"%d \n",&x);for(i=0;i<x;i++){fscanf(find,"%d %s %s %d %d %d %d %d %d\n",&electivedata[i].electivenum,&el ectivedata[i].electivename,&electivedata[i].electivekind,&electivedata[i].totalclassnu m,&electivedata[i].techclassnum,&electivedata[i].expclassnum,&electivedata[i].credi ts,&electivedata[i].classterm,&electivedata[i].students);}xx:io=0;system("cls");gotoxy(7,3);printf("a:search by electivenum;\n b:search by electivename;\nc:search by electivekind;\n d:search by totalclassnum;\n e:search by techclassnum;\n f:search by expclassnum;\n g:search by credits;\n h:search by classterm;\n i:search by students\n");gotoxy(7,12);cprintf("j:Return to the main menu");gotoxy(7,13);scanf("%c",&A);switch(A){case 97: goto a;case 98: goto b;case 99: goto c;case 100: goto d;case 101: goto e;case 102: goto f;case 103: goto g;case 104: goto h;case 105: goto i;case 106: goto t2;default: system("cls");gotoxy(24,12);cprintf("wrongchoice\n");system("pause");goto xx;}a:screen=0;{system("cls");gotoxy(24,12);cprintf("Please write down the electivenum\n");gotoxy(24,13);scanf("%d",&num);system("cls");for(i=0; i<x; i++){if(electivedata[i].electivenum==num){if(screen>0){system("pause");system("cls");}cprintf("Here is the information you want:\n");cprintf("num:%d\n",electivedata[i].electivenum);cprintf("name:%s\n",electivedata[i].electivename);cprintf("kind:%s\n",electivedata[i].electivekind);cprintf("class:%d\n",electivedata[i].totalclassnum);cprintf("techclass:%d\n",electivedata[i].techclassnum);cprintf("expclass:%d\n",electivedata[i].expclassnum);cprintf("credits:%d\n",electivedata[i].credits);cprintf("term:%d\n",electivedata[i].classterm);cprintf("students:%d\n",electivedata[i].students);io=1;screen=screen+1;} }if(io==0){system("cls");cprintf("wrong number");gotoxy(1,24);system("pause");goto xx;}system("pause");goto xx;}b:screen=0;{system("cls");gotoxy(24,12);cprintf("Please write down the electivename\n");gotoxy(24,13); scanf("%s",&name);system("cls");for(i=0; i<x; i++){if(strcmp(electivedata[i].electivename,name)==0){if(screen>0){system("pause");system("cls");}cprintf("Here is the information you want:\n");cprintf("num:%d\n",electivedata[i].electivenum);cprintf("name:%s\n",electivedata[i].electivename);cprintf("kind:%s\n",electivedata[i].electivekind);cprintf("class:%d\n",electivedata[i].totalclassnum);cprintf("techclass:%d\n",electivedata[i].techclassnum);cprintf("expclass:%d\n",electivedata[i].expclassnum);cprintf("credits:%d\n",electivedata[i].credits);cprintf("term:%d\n",electivedata[i].classterm);cprintf("students:%d\n",electivedata[i].students);io=1;screen=screen+1;}}if(io==0){system("cls");cprintf("wrong number");gotoxy(1,24);system("pause");goto xx;}system("pause");goto xx;}c:screen=0;{system("cls");gotoxy(24,12);cprintf("Please write down the electivenkind\n");gotoxy(24,13); scanf("%s",&kind);system("cls");for(i=0; i<x; i++){if(strcmp(electivedata[i].electivekind,kind)==0){if(screen>0){system("pause");system("cls");}cprintf("Here is the information you want:\n");cprintf("num:%d\n",electivedata[i].electivenum);cprintf("name:%s\n",electivedata[i].electivename);cprintf("kind:%s\n",electivedata[i].electivekind);cprintf("class:%d\n",electivedata[i].totalclassnum);cprintf("techclass:%d\n",electivedata[i].techclassnum);cprintf("expclass:%d\n",electivedata[i].expclassnum);cprintf("credits:%d\n",electivedata[i].credits);cprintf("term:%d\n",electivedata[i].classterm);cprintf("students:%d\n",electivedata[i].students);io=1; screen=screen+1;} }if(io==0){system("cls");cprintf("wrong number");gotoxy(1,24);system("pause");goto xx;}system("pause");goto xx;}d:screen=0;{system("cls");gotoxy(24,12);cprintf("Please write down the totalclassnum\n");gotoxy(24,13); scanf("%d",&tonum);system("cls");for(i=0; i<x; i++){if(electivedata[i].totalclassnum==tonum){if(screen>0){system("pause");system("cls");}cprintf("Here is the information you want:\n");cprintf("num:%d\n",electivedata[i].electivenum);cprintf("name:%s\n",electivedata[i].electivename);cprintf("kind:%s\n",electivedata[i].electivekind);cprintf("class:%d\n",electivedata[i].totalclassnum);cprintf("techclass:%d\n",electivedata[i].techclassnum);cprintf("expclass:%d\n",electivedata[i].expclassnum);cprintf("credits:%d\n",electivedata[i].credits);cprintf("term:%d\n",electivedata[i].classterm);cprintf("students:%d\n",electivedata[i].students);io=1;screen=screen+1;} }if(io==0){system("cls");cprintf("wrong number");gotoxy(1,24);system("pause");goto xx;}system("pause");goto xx;}e:screen=0;{system("cls");gotoxy(24,12);cprintf("Please write down the techclassnum\n");gotoxy(24,13); scanf("%d",&tcnum);system("cls");for(i=0; i<x; i++){if(electivedata[i].techclassnum==tcnum){if(screen>0){system("pause");system("cls");}cprintf("Here is the information you want:\n");cprintf("num:%d\n",electivedata[i].electivenum);。

学生选课管理系统设计(c语言)课程设计

学生选课管理系统设计(c语言)课程设计

题目一、学生选课管理系统目录第一部分:课程设计名称、目的、要求... 第二部分:程序总体设计思路........... 第三部分:程序功能划分、图示及流程图. 第四部分:程序设计数据、运行结果..... 第五部分:程序的优缺点............... 第六部分:心得体会................... 第七部分:附录(源程序)............. 第八部分:附录(参考文献)...........第一部分:课程设计名称、目的、要求名称:学生选修课程系统设计目的:运用C语言提高解决实际问题的能力实验环境:Microsoft Visual C++ 6.0内容:假定有n门课程,每门课程有课程编号,课程名称,课程性质,总学时,授课学时,实验或上机学时,学分,开课学期等信息,学生可按要求(如总学分不得少于60)自由选课。

【功能】系统以菜单方式工作课程信息录入功能(课程信息用文件保存)--输入课程信息浏览功能--输出查询功能:(至少一种查询方式)--算法按学分查询按课程性质查询学生选修课程(可选项)第二部分:程序总体设计思路由于C语言是面对过程的语言,故我的设计思路是根据目标程序运行的过程来编写的。

具体的设计思路如下:程序的要求是设计学生选修课管理系统,对选修课程能够进行录入和修改操作等,要求有菜单界面和退出功能。

首先,考虑到程序的数据输入,可以设置一个管理员登陆选项,通过该选项进入管理员界面,进行选修课的录入和修改操作,最后将录入的课程保存到相应的文件中。

然后定义各种函数的功能包括查看,查询,删除等。

另一个为学生登陆界面,该界面学生可以进行课程选择和浏览查询等操作。

在进行该操作之前需要对管理员保存的文件进行读取,然后对其中的内容进行查询等,在学生选好课程以后,可以将其选好的课程保存于相应的文件中,以便下次进行修改。

通过函数的层层调用来实现程序的逻辑结构。

中间通过文件的打开和关闭实现对文件内部所包含的数据的操作。

Linux环境下C语言《学生选课管理系统》全源代码,含流程图、个人总结.(对您有用的话顶一下!)

Linux环境下C语言《学生选课管理系统》全源代码,含流程图、个人总结.(对您有用的话顶一下!)

//第一部分:结构体、流程图、总结………………Page1//第二部分C语言源代码………………Page10//第一部分一、简介:本系统称为“学生选课管理系统”,主要功能是实现对学生信息和教师信息的管理,以及学生成绩的管理。

该系统分为三级身份:管理员、教师、学生。

其中管理员的权限有:1)、添加学生或老师的信息,2)、删除学生或老师信息,3、修改学生或老师信息,4)查找学生或老师信息。

教师的权限:1)仅可以修改自己密码,2)查看所有关于自身的信息,3)修改其所授科目的学生科目的成绩。

学生的权限:仅可以修改自己的密码,查看所有有关自己的信息,另外还要可以选课。

二、设计思想;[1]:分别把学生信息、科目信息和教师—科目信息建立三个链表。

//科目信息typedef struct subject_info{float SUB_notes[3]; //科目成绩int SUB_csscore; //科目学分char SUB_csname[32]; //科目名称struct list_head list;}SUB;//学生信息typedef struct STU_info{float STU_totalscore; //总分int STU_id; //学号int STU_age; //年龄int STU_grade; //年级int STU_place; //名次char STU_name[32]; //姓名char STU_psword[32]; //密码SUB subject[3];struct list_head list;}STU;//教师信息:typedef struct TCH_info{int TCH_id; //工号char TCH_name[32]; //姓名char TCH_psword[32]; //密码SUB s ubject[1];struct list_head list;}TEC;//管理员信息typedef struct ADM_info{char ADM_usename[8];char ADM_psword[6];}ADM;ADM use[1];#define Y 'y'#define N 'n'#define S_FLAG 's'#denfine T_FLAG 't'#define A_FLAG 'a'void gettime(); //获取当前时间void main_menu(); //主菜单void stu_login(); //学生登录void openf (char *filename); //判断文件是否存在void tec_login(); //老师登录void adm_login(); //管理员登录void adm_nextmenu(); //管理员2级菜单void a_updt_stuinfo(); //操作学生信息void a_updt_tecinfo(); //操作老师信息void a_updt_myinfo(); //操作管理员自身信息void a_add_stuinfo(); //添加学生信息void a_add_tecinfo(); //添加老师信息void a_mdify_stuinfo(); //修改学生信息void a_del_info(char flag); //删除信息void a_mdify_tecinfo(); //修改老师信息void a_seek_stuinfo(); //查找学生信息void a_seek_tecinfo(); //查找老师信息void show (char flag); //显示信息void save (char flag,char system); //保存信息void check(char flag); //验证密码void commom(); //公用函数集合void a_show(char flag); //显示信息void a_seek_info(char flag); //查找信息void a_mdify_info(char flag); //修改学生或老师信息void stu_nextmenu(int tmpid); //学生菜单void tec_nextmenu(int tmpid); //老师菜单void s_show_myinfo(int tmpid); //学生显示自己信息void t_show_myinfo(int tmpid); //教师显示自己信息void s_updt_myinfo(int tmpid); //学生更新自己信息void s_select_subject(int tmpid); //学生选课void t_updt_stuinfo(int tmpid); //教授更新自己信息void t_updt_myinfo(int tmpid); //教授显示自己信息void readf(); //从文件中读取信息void stu_sort(); //对学生链表排序float ave (float core[3]); //求平均成绩float (*f)(float core[3]); //int inputpsword(char *pass); //输入密码回显* [2]: 模块分析开始主界面E:exit 1:student 2:teacer 3:admin退出stu_login tec_login amd_login student_nextmenu teacher_menu adminmenustudent_nextmenustu_show_myinfo stu_update_mypsword stu_select_mysubject 返回上一级\teachertec_show_myinfo() tec_update_mypsword(); tec_next_menu(); 返回上一级tec_next_menu()tec_ show_stuinfo() tec__update_stuscore(); 返回上一级输入信息、保存修改保存adm_nextmenuADM_update_stuinfo ADM_update_tecinfo ADM_updat_myinfo 返回上一级Add del update show Add del update show change_mypsword[3]: 流程图1 2 3 4NY YY Y Y Y开始 主界面login 1、2、3、4tec_logi stu_login exit adm_login loginlogin loginqNY1 2 3 4Y NNNY Y Ystu_login 1、2.、3、4 show_info chag_pswod sign_sub returnY1 2 3 4YN NNY Y Ytec_login 1、2.、3、4 show_info chag_pswod up_stuinfo returnY1 2 3 4YNNNY Y Yadm_login1、2.、3、4 updt_stuinfo chag_pswod updt_tecinfo return三、总结《学生选课管理系统》,5天。

学生选课系统详细设计文档1

学生选课系统详细设计文档1

学生选课系统详细设计文档执笔人1引言 (3)1.1编写目的 (3)1.3定义 (3)1.4参考资料 (3)2程序系统的结构 (4)3程序1(标识符)设计说明 (10)3.1功能 (15)3.2性能 (15)3.3输人项 (15)3.4输出项 (15)3.5算法 (15)3.6流程逻辑 (15)3.7接口 (16)3.8存储分配 (16)3.9注释设计 (16)3.10限制条件 (17)3.11测试计划 (17)4用户界面设计说明. (18)4.1用户界面说明 (19)4.2用户界面与模块关系表 (20)详细设计说明书1引言1.1编写目的该详细设计说明书的目的在于根据需求说明书与概要设计说明书提出该系统的详细设计,即系统的详细架构,主要包括系统的模块划分、程序系统的结构、各个模块的流程以及各层次中每个程序的设计考虑。

用户群体为需要选课的学生。

1.2定义(1)Active Server Pages (ASP) 是服务器端脚本编写环境,是由Server端脚本、对象及组件拓展过的标准主页使用它可以创建和运行动态、交互的Web 页和基于Web 的功能强大的应用程序。

ASP程序是由文本、HTML标记和脚本组合而成的。

在ASP程序中,脚本通过分隔符与文本和HTML标记区分开来。

ASP用分隔符〈%和%〉包括脚本命令。

由分隔符括起的命令称为主脚本命令,这些命令由主脚本语言进行处理。

在ASP分隔符〈%和% 〉内,可以包括主脚本语言允许的任何语句、表达式和操作符等。

(2)SQL Server 是一个具备完全Web 支持的数据库产品,提供了对可扩展标记语言(XML) 的核心支持以及在Internet 上和防火墙外进行查询的能力,提供了以Web 标准为基础的扩展数据库编程功能。

丰富的XML 和Internet 标准支持允许使用内置的存储过程以XML 格式轻松存储和检索数据。

1.4参考资料1.魏志华.《软件工程》.北京:清华大学出版社,20052.张海藩.《软件工程导论》.北京:清华大学出版社,20133. Roger S. Pressman.软件工程-实践者之路第五版.影印.清华大学出版社.20012程序系统的结构1.总体模块如图1所示。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
} fclose(fp); main(); }
/*课程信息浏览*/ void browser()
-1-
作者:宁波工程学院 计科专业 周咲宇
{ void main(); FILE *fp; struct course c; int a; if((fp=fopen("course.txt","r"))==NULL) { printf("\nCannot open course!\n"); } printf("课程编号 课程名称 课程性质
/*课程信息录入*/ void insert() {
void main(); FILE *fp; struct course c; int count; int i; if((fp=fopen("course.txt","a+"))==NULL) {
printf("cannot open file\n"); } printf("\n 请输入课程门数:\n"); scanf("%d",&count); printf("课程编号 课程名称 课程性质
if(um==c.num) break;
} fclose(fp); if((fp=fopen("student.txt","a+"))==NULL) {
printf("\nCannot open student!\n"); } fprintf(fp,"%d %d %s\n",s.snum,um,); fclose(fp); printf("\n1-返回主菜单;2-退出选课系统\n"); scanf("%d",&a); if(a==1)
main(); else
exit(0); }
/*学生选修课程*/ void xuan_ke() {
void main(); struct student s; struct course c; int a; FILE *fp; printf("\n 请输入您的学号及您要选择的课程编号:"); scanf("%d%d",&s.snum,&um); if((fp=fopen("course.txt","r"))==NULL) {
开课学期:\n");
for(;!feof(fp);) {
总学时
授课学时
实验或上机学时
学分
fscanf(fp,"%d %s %s %d %d %d %d %d\n",&c.num,&,&c.kind,&c.time,&c.ttime,&c.et ime,&c.mark,&c.term);
printf("%5d%12s%9s%9d%9d%11d%11d%11d\n",c.num,,c.kind,c.timeprintf("%5d%12s%9s%9d%9d%11d%11d%11d\n",c.num,,c.kind,c.time,c.ttime,c.etime, c.mark,c.term);
} } else{
printf("输入错误!"); exit(1); } fclose(fp); printf("\n1-返回主菜单;2-退出选课系统\n"); scanf("%d",&a); if(a==1) main(); else exit(0); }
\n");
printf("
2- 浏 览 课 程 信 息
\n");
printf("
3- 查 询 课 程 信 息
\n");
printf("
4- 统 计 选 课 情 况
\n");
printf("
5- 进 入 选 课 操 作
\n");
printf("
0- 退 出 选 课 系 统
\n");
printf("***********************************************************************
main(); else
exit(0); }
/*主菜单*/ int main(void) {
int n,w=0; printf("*********************************************************************** *********\n");
if(c.mark==score)
printf("%5d%12s%9s%9d%9d%11d%11d%11d\n",c.num,,c.kind,c.time,c.ttime,c.etime, c.mark,c.term);
} } else if(b==2){
printf("\n 请输入您要查询的课程性质:\n"); scanf("%s",&kind);
if((fp=fopen("course.txt","r"))==NULL) {
printf("\nCannot open course!\n"); } printf("课程编号 课程名称 课程性质 总学时 授课学时 实验或上机学时 学 分 开课学期:\n"); for(;!feof(fp);) { fscanf(fp,"%d%s%s%d%d%d%d%d\n",&c.num,&,&c.kind,&c.time,&c.ttime,&c.etime, &c.mark,&c.term); if(strcmp(c.kind,kind)==0)
printf("请选择查询方式,输入选项数字:"); scanf("%d",&b); if(b==1) {
printf("\n 请输入您要查询的学分:\n"); scanf("%d",&score);
if((fp=fopen("course.txt","r"))==NULL) {
printf("\nCannot open course!\n"); } printf("课程编号 课程名称 课程性质 总学时 授课学时 实验或上机学时 学
作者:宁波工程学院 计科专业 周咲宇
源程序清单:
#include<stdio.h> #include<stdlib.h> #include <string.h>
struct course {
int num; char name[20]; char kind[10]; int time; int ttime; int etime; int mark; int term; }; struct student { int snum; int cnum; char cname[20]; };
运行结果:
-5-
作者:宁波工程学院 计科专业 周咲宇
1.主菜单功能
2.课程信息录入或插入功能 4.课程信息浏览功能
-6-
作者:宁波工程学院 计科专业 周咲宇
5.课程信息查询功能
6.学生选修课程功能 7.统计选课情况功能
-7-
作者:宁波工程学院 计科专业 周咲宇 -8-
} fclose(fp); printf("\n1-返回主菜单;2-退出选课系统\n");
scanf("%d",&a); if(a==1)
main(); else
exit(0); }
/*课程信息查询*/ void search() {
void main(); FILE *fp; struct course c; int score; char kind[10]; int a; int b; printf("1.按学分查询,2.按课程性质查询.\n");
printf("\nCannot open course!\n"); } for(;!feof(fp);) {
fscanf(fp,"%d %s %s %d %d %d %d %d\n",&c.num,&,&c.kind,&c.time,&c.ttime,&c.et ime,&c.mark,&c.term);
开课学期:\n"); for(i=0;i<count;i++) {
总学时
授课学时
实验或上机学时
学分
scanf("%d %s %s %d %d %d %d %d",&c.num,&,&c.kind,&c.time,&c.ttime,&c.etime, &c.mark,&c.term);
fprintf(fp,"%d %s %s %d %d %d %d %d\n",c.num,,c.kind,c.time,c.ttime,c.etime,c.mark, c.term);
*********\n");
printf("
请选择输入选项前数字:");
相关文档
最新文档