淮海工学院课程设计学生成绩管理系统_第1页
淮海工学院课程设计学生成绩管理系统_第2页
淮海工学院课程设计学生成绩管理系统_第3页
淮海工学院课程设计学生成绩管理系统_第4页
淮海工学院课程设计学生成绩管理系统_第5页
已阅读5页,还剩59页未读 继续免费阅读

下载本文档

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

文档简介

课 程 设 计 报 告 书 专 用 纸淮海工学院课程设计报告书 课程名称: 计算机技术课程设计 题 目: 学生成绩管理系统 系 (院): 电子工程学院 学 期: 10-11-2 专业班级: 姓 名: 学 号: 评语:成绩:签名:日期:1、 准2、 系3、 系1 引言做系统前,首先,我详细看了C程序设计教程(教科书)的第十章文件,基本自学会了文件的相关内容,理解了相关函数的用法和作用;另外,我上网查询了很多相关资料,还有找了很多相关的系统,每一个我都详细的看了一遍,这样加深了我对C的理解以及对文件的相关内容进一步理解;再者,我到图书馆借阅了相关程序的设计教程书,学习了教科书上没有的东西;最后我尝试着自己去做系统,经过了无数次的上机调试,我自己做的小型系统终于在机器上运行了出来,完全符合课程设计要求,功能齐全。2 系统功能简介1输入职工信息2删除职工信息3查询职工信息4修改职工信5统计职工信息6排序职工信息7保存职工信息8显示职工信息3 功能划分,模块详细说明:1) 主函数,控制整个系统的执行流程,使系统菜单可以循环执行2) 菜单函数,提供一个可以选择任何一个功能的选择窗口,供用户选择需要执行的操作3) 打开文件函数,把文件的信息打开到一个结构体数组中4) 输入函数,提供录入职工信息功能5) 输出函数,提供学生信息输出功能,浏览学生信息6) 排序函数,提供对学生信息检索,按条件查找排序功能7) 删除学生信息函数,提供对学生信息的删除功能8) 退出函数,执行退出功能4 关键功能算法和绘制函数流程图4.1 整体流程图开 始主 函 数 菜 单Swith删除信息排序查询信息查询输出显示输入功能退 出输入功能输入功能输入功能Y继续结 束图1功能模块4.2 显示模块流程图开 始查找磁盘上的文件成功否用for语句实现把文件的所有内容输入到数组中结 束图2显示模块4.3 保存模块流程图开始建立(查找)磁盘文件成功否用for语句实现把数组的所有内容储存在文件中 结束图3保存模块4.4 输入模块流程图开 始输入各个学生的信息Y继续结束N图4 输入模块4.5 排序模块流程图:开 始 从文件中读入数据swith平均成绩总成绩英语成绩数学成绩语文成绩结束图5排序模块4.6 显示模块流程图:开 始执行函数输出每个学生的信息Y学号不存在结 束图6显示模块4.7 删除函数流程图:开 始执行open()函数输入需要删除的学生号是否找到把该员工后面的每一个学生信息陆续前提执行close()函数把新的学生信息输出到文件中保存起来结 束图7删除模块4.8 查找函数的流程图:开 始执行open()函数从文件中读入数据输入要查询的学生学号是否存在匹配输出学生的各科成绩结 束图8查找模块5 运行结果说明5.1 主菜单:图9主菜单5.2 输入界面:图10输入界面5.3 排序界面图11排序界面5.4 查询界面:图12查询界面5.5 删除界面:图13删除界面5.6 保存界面:图14保存界面5.7 修改界面图15修改界面5.8 统计界面图16统计界面6 简要总结及自我评价忙碌了一个多星期,在大家的共同努力下,我们总算将此程序设计出来。尽管不是自己独立完成,但仍然很高兴,因为在设计的过程中,让我了解到要设计一个大型程序,查找资料是至关重要的,在他人的基础上,再根据自己所学进行修改与调试,最后设计出自己想要的程序,这过程艰辛,但只要你持之以恒,成功指日可待。另外平时扎实的基础也很关键,因为如果你平时学得就不怎么样,那么你面对这么一个比较有难度的程序,你可能会望而却步,看他人的程序都是个难点,更别说让你自己去设计。为了解决此。类问题,最好就是多向同学,老师请教,不要怕难为情。尤其是老师,评他们多年的编写程序的经验,要解决我们的问题,对他们来说只是小事。在设计这个程序时,我们刚开始是根据老师给我们提供的资料,用画图以及循环将框架设计出来,但是接下去便无从下手了,计算是个关键和难点,我们也查了相应的资料,但是它上面用得是坐标来做的,所以为了方便设计程序,我们也改为坐标来做的,这样计算问题解决了。接下去就是按键问题,我们的资料是用鼠标做的,所以关于按键这个函数就只能我们自己设计,还好手头有类似的资料,经过自己的反复尝试以及与与同学的讨论,这也不难,最好还是被我们搞定了。最后就是闪烁,这个设计的方法很死板,都一个类型,就是算坐标比较烦琐,要确定好它的位置,但是这些只要你自己愿意去尝试,问题都可以迎刃而解的。从这一个多星期的设计过程中,我看到了大家的拼搏与努力,也让我知道团队精神得难能可贵,尽管一年下来大家不怎么有多大接触,但是彼此之间的友谊已经在我们心里扎根生底,在遇到问题时,我们会共同进退,每个人都很慷慨不会因为是通过自己艰辛劳动设计出来的东西而不准他人剽窃了。总之,这次设计程序让我受益良多,我会好好珍惜像这种难得的机会7 参考文献1谭浩强著.C程序设计(第三版). 北京:清华大学出版社,20052Herbert Schildt著.王曦若译.ANSI C标准详解. 北京:学院出版社,19943谭浩强著.C程序设计(第二版). 北京:清华大学出版社,1999 程序:#include stdio.h /*标准输入输出函数库*/#include stdlib.h /*标准函数库*/#include string.h /*字符串函数库*/#include conio.h /*屏幕操作函数库*/#define HEADER1 -students information- n#define HEADER2 | Number | Name |C|Math|English| Total | Average | n#define HEADER3 |-|-|-|-|-|-|-|#define FORMAT | %-10s |%-15s|%4d|%4d|%4d| %4d | %.2f |n#define DATA p-data.num,,p-data.egrade,p-data.mgrade,p-data.cgrade,p-data.total,p-data.ave#define END - nint shoudsave=0; /* */struct studentchar num10;/* Number */char name20;char sex4;int cgrade;int mgrade;int egrade;int total;float ave;char neartime10;/* 最近更新时间 */;typedef struct nodestruct student data;struct node *next;Node,*Link;/*函数*/void menu()system(cls); /*调用DOS命令,清屏.与clrscr()功能相同*/cprintf(n);printf(Students performance management systemnn);printf(Menun);printf( *1 input 2 delete *n);printf( *3 search 4 modify *n);printf( *5count *n);printf( *6 sort 7 save *n); printf( *8 dispaly 0 exit *n);printf(n);/*cprintf()送格式化输出至文本窗口屏幕中*/void printheader() /*格式化输出表头*/printf(HEADER1);printf(HEADER2);printf(HEADER3);void printdata(Node *pp) /*格式化输出表中数据*/Node* p;p=pp;printf(FORMAT,DATA);void Wrong()printf(n=error!n);void Nofind()printf(n=No record now!Please press Entern);void Disp(Link l) /*显示单链表l中存储的学生记录,内容为student结构中定义的内容*/Node *p;p=l-next; /*l存储的是单链表中头结点的指针,该头结点没有存储学生信息,指针域指向的后继结点才有学生信息*/if(!p) /*p=NULL,NUll在stdlib中定义为0*/printf(n=No record now!Please press Entern);getchar();return;printf(nn);printheader(); /*输出表格头部*/while(p) /*逐条输出链表中存储的学生信息*/printdata(p);p=p-next; /*移动直下一个结点*/printf(HEADER3);getchar();/*作用:用于定位链表中符合要求的节点,并返回指向该节点的指针参数:findmess保存要查找的具体内容; nameornum保存按什么查找; 在单链表l中查找;*/Node* Locate(Link l,char findmess,char nameornum) /* 该函数用于定位连表中符合要求的接点,并返回该指针 */Node *r;if(strcmp(nameornum,num)=0) /* 按Number查询 */r=l-next;while(r!=NULL)if(strcmp(r-data.num,findmess)=0)return r;r=r-next;else if(strcmp(nameornum,name)=0) /* 按Name查询 */r=l-next;while(r!=NULL)if(strcmp(,findmess)=0)return r;r=r-next;return 0;/*增加学生记录*/void Add(Link l)Node *p,*r,*s; /*实现添加操作的临时的结构体指针变量*/char ch,flag=0,num10;r=l;s=l-next;system(cls);Disp(l); /*先打印出已有的学生信息*/while(r-next!=NULL)r=r-next; /*将指针移至于链表最末尾,准备添加记录*/while(1) /*一次可输入多条记录,直至输入Number为0的记录结点添加操作*/while(1) /*输入Number,保证该Number没有被使用,若输入Number为0,则退出添加记录操作*/printf(please input the Number(pressoto upper level):);scanf(%s,num);flag=0;if(strcmp(num,0)=0) /*输入为0,则退出添加操作,返回主界面*/ return;s=l-next; while(s) /*查询该Number是否已经存在,若存在则要求重新输入一个未被占用的Number*/ if(strcmp(s-data.num,num)=0) flag=1; break; s=s-next; if(flag=1) /*提示用户是否重新输入*/ getchar(); printf(=Number %s existed already!Please press Enter.input again?(y/n):,num); scanf(%c,&ch); if(ch=y|ch=Y) continue; else return; else break;p=(Node *)malloc(sizeof(Node); /*申请内存空间*/if(!p) printf(n Allocate memory failure ); /*如没有申请到,打印提示信息*/ return ; /*返回主界面*/ strcpy(p-data.num,num); /*将字符串num拷贝到p-data.num中*/printf(please input the Name:);scanf(%s,);getchar();printf(please input the score of C:);scanf(%d,&p-data.cgrade);getchar();printf(please input the score of Math:);scanf(%d,&p-data.mgrade);getchar();printf(please input the score of English:);scanf(%d,&p-data.egrade);getchar();/* 信息输入已经完成 */p-next=NULL;r-next=p;r=p;shoudsave=1;/*函数*/void Qur(Link l) /*按Number或Name,查询学生记录*/int sel; /*1:按Number查,2:按Name查,其他:返回主界面(菜单)*/char findmess20; /*保存用户输入的查询内容*/Node *p;if(!l-next)/*若链表为空*/system(cls);printf(n=No record now!Please press Entern);return;system(cls);printf(n=1Search by Numbern=2Search by Namen);printf( select1,2:);scanf(%d,&sel);if(sel=1)/* Number */printf(please input the Number you want to search:);scanf(%s,findmess);p=Locate(l,findmess,num);/*在l中查找Number为searchinput值的节点,并返回节点的指针*/if(p)/*若p!=NULL*/ printheader(); printdata(p); printf(END); printf(press any key to back); getchar();elseNofind();getchar();else if(sel=2) /* Name */printf(please input the Name you want to search:);scanf(%s,findmess);p=Locate(l,findmess,name);if(p) printheader(); printdata(p); printf(END); printf(press any key to back); getchar();else Nofind(); getchar();elseWrong();/*函数*/*删除学生记录:先找到保存该学生记录的节点,然后删除该节点*/void Del(Link l) /* 删除 */int sel;Node *p,*r;char findmess20;if(!l-next)printf(n=no record!n);getchar();return;printf(n=1Delete by Numbern=2Delete by Namen);scanf(%d,&sel);if(sel=1)printf(please input the Number you want to delete:);scanf(%s,findmess);p=Locate(l,findmess,num);if(p)r=l;while(r-next!=p)r=r-next;r-next=p-next;free(p);printf(n=Delete successful!n);getchar();shoudsave=1;elseNofind();else if(sel=2)printf(please input the Name you want to delete:);scanf(%s,findmess);p=Locate(l,findmess,name);if(p)r=l;while(r-next!=p)r=r-next;r-next=p-next;free(p);printf(n=Delete successful!n);getchar();shoudsave=1;elseNofind();getchar();elseWrong();getchar();/*函数*/*修改学生记录。先按输入的Number查询到该记录,然后提示用户修改Number之外的值,Number不能修改*/void Modify(Link l)Node *p;char findmess20;if(!l-next) system(cls);printf(n=no record!n);getchar();return;system(cls);printf(modify the information);Disp(l);printf(please input the Number you want to modify:);scanf(%s,findmess);p=Locate(l,findmess,num);if(p)printf(please input the new Number(which was %s):,p-data.num);scanf(%s,p-data.num);printf(please input the new Name(which was %s):,);scanf(%s,);getchar();printf(please input the new C score(which was %d):,p-data.cgrade);scanf(%d,&p-data.cgrade);getchar();printf(please input the new Math score(which was%d):,p-data.mgrade);scanf(%d,&p-data.mgrade);getchar();printf(please input the new English score(which was%d):,p-data.egrade);scanf(%d,&p-data.egrade);printf(n=modify successful!n);shoudsave=1;getchar();elseNofind();getchar(); void Tongji(Link l)Node *pm,*pe,*pc,*pt,*pa; /* 用于指向分数最高的接点 */Node *r=l-next;int num1=0,num2=0,num3=0,num4=0,num5=0;int select;if(!r)printf(n=no record!n);return ;system(cls);pm=pe=pc=pt=pa=r;printf(select the subject you want to count:1.C 2.Math 3.Englishn);scanf(%d,&select);switch(select)case 1:printf(select the band:1.0-60 2.60-70 3.70-80 4.80-90 5.90-100n); scanf(%d,&select); switch(select) case 1: while(r!=NULL) if(r-data.cgradenext; printf(there are %d studentsn,num1); break; case 2: while(r!=NULL) if(r-data.cgrade=60&r-data.cgradenext; printf(there are %d studentsn,num1); break; case 3: while(r!=NULL) if(r-data.cgrade=70&r-data.cgradenext; printf(there are %d studentsn,num1); break; case 4: while(r!=NULL) if(r-data.cgrade=80&r-data.cgradenext; printf(there are %d studentsn,num1); break; case 5: while(r!=NULL) if(r-data.cgrade=90&r-data.cgradenext; printf(there are %d studentsn,num1); break; break;case 2:printf(select the band:1.0-60 2.60-70 3.70-80 4.80-90 5.90-100n); scanf(%d,&select); switch(select) case 1: while(r!=NULL) if(r-data.mgradenext; printf(there are %d studentsn,num1); break; case 2: while(r!=NULL) if(r-data.mgrade=60&r-data.mgradenext; printf(there are %d studentsn,num1); break; case 3: while(r!=NULL) if(r-data.mgrade=70&r-data.mgradenext; printf(there are %d studentsn,num1); break; case 4: while(r!=NULL) if(r-data.mgrade=80&r-data.mgradenext; printf(there are %d studentsn,num1); break; case 5: while(r!=NULL) if(r-data.mgrade=90&r-data.mgradenext; printf(there are %d studentsn,num1); break; break;case 3:printf(select the band:1.0-60 2.60-70 3.70-80 4.80-90 5.90-100n); scanf(%d,&select); switch(select) case 1: while(r!=NULL) if(r-data.egradenext; printf(there are %d studentsn,num1); break; case 2: while(r!=NULL) if(r-data.egrade=60&r-data.egradenext; printf(there are %d studentsn,num1); break; case 3: while(r!=NULL) if(r-data.egrade=70&r-data.egradenext; printf(there are %d studentsn,num1); break; case 4: while(r!=NULL) if(r-data.egrade=80&r-data.egradenext; printf(there are %d studentsn,num1); break; case 5: while(r!=NULL) if(r-data.egrade=90&r-data.egradenext; printf(there are %d studentsn,num1); break; break;getchar();void Sort(Link l) int cho; printf(please select the subject you want to sortn); printf(1.sort by Cn); printf(2.sort by Mathn); printf(3.sort by Englishn); printf(4.sort by Totaln); printf(5.sort by Averagen); scanf(%d,&cho); switch(cho) case 1: Link ll; Node *p,*rr,*s; ll=(Link)malloc(sizeof(Node); /* 用于做新的连表 */ ll-next=NULL; if(l-next=NULL) printf(n=no record!n); return ; p=l-next; while(p) s=(Node*)malloc(sizeof(Node); /* 新建接点用于保存信息 */ s-data=p-data; s-next=NULL; rr=ll; while(rr-next!=NULL & rr-next-data.cgrade=p-data.cgrade) rr=rr-next; if(rr-next=NULL) rr-next=s; else s-next=rr-next; rr-next=s; p=p-next; free(l); l-next=ll-next; system(cls); printf(n=sort done!

温馨提示

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

评论

0/150

提交评论