c++课程设计学生考勤管理系统报告.doc_第1页
c++课程设计学生考勤管理系统报告.doc_第2页
c++课程设计学生考勤管理系统报告.doc_第3页
c++课程设计学生考勤管理系统报告.doc_第4页
c++课程设计学生考勤管理系统报告.doc_第5页
已阅读5页,还剩20页未读 继续免费阅读

下载本文档

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

文档简介

信息科学与技术学院程序设计基础课程设计报告题目名称: 学生考勤管理系统 学生姓名: 郭晨晨 学 号: 2013508093 专业班级: 13级计科(3)班指导教师: 郭理 2013年6月6日目录目录11. 课程设计题目与要求21.1 课题目的和要求21.3 课题意义22 总体设计32.1功能模块设计32.2系统设计方案33 详细设计43.1 数据结构设计43.2 主模块设计43.2.1建立学生缺课记录子模块43.2.2修改学生缺课记录子模块53.2.3修改学生缺课记录子模块63.2.4查看单科旷课记录子模块73.2.5查看学生旷课记录子模块83.2.6载入学生旷课记录子模块93.2.7储存学生旷课记录子模快104. 运行结果124.1运行125. 课程设计总结14结束语14参考文献15附录:源代码15 1. 课程设计题目与要求1.1 课题目的和要求设计目的:要求实现-“学生考勤管理程序”记录学生的缺课情况,它包括:缺课日期、第几节课、课程名称、学生姓名、缺课类型(迟到、早退、请假及旷课)。1.2 设计要求: 1.录入学生的缺课记录;2修改某个学生的缺课记录;3查询某个学生的缺课情况;4统计某段时间内,某门课旷课学生姓名及旷课次数,按旷课次数由多到少排序; 5统计某段时间内,有学生旷课的课程及旷课人次,按旷课人次由多到少排序;6.系统以菜单方式工作。1.3 课题意义程序实践是本科生重要教学环节之一。通过程序实践,强化学生的计算机应用技能,使学生验证、巩固和充实所学的理论知识, 加深对相关内容的理解,拓宽知识面,培养学生的创新精神和实践能力学生考勤管理程序可以大大减缓学生考勤人员的工作量, 方便了平时上课学生的出勤率的管理。 2 总体设计2.1功能模块设计根据分析整个系统主要划分为7个功能模块,分别执行要求中的功能。数据管理中可以对学生的基本信息、课程的基本信息、学生缺课的查询、添加、删除和修改。查询管理通过根据学生姓名,课程姓名 时间段儿等信息,查询单个学生的缺课记录,单科课的旷课记录,单个学生的旷课记录。功能模块图如图1所示:图1功能模块图2.2系统设计方案这个程序是过程性语言设计的。运用多种条件语句,主体采用的是链表指针。系统的设计采用了数组语句、选择语句和循环语句,在需要处理大量同类数据时,这样就使程序书写更加简洁。程序使用了布尔函数。选择语句多采用if多分支选择结构与switch语句。首先计算switch表达式,然后在caes子句中寻找值相等的常量表达式,并以此为入口符号,由此开始顺序执行。循环语句采用了for语句等、do-while语句,for语句用于已知循环次数的循环结构,括号中的三个量分别用来表示循环变量初值、循环终值和循环增量。do-while语句先循环后判断, Break语句在switch语句中,保证多分支情况的正确执行,在循环语句中,强制终止本层循环。保存和读取函数是典型的函数功能,一个程序是由若干个函数组成的,保存和读取函数是和其他函数互相调用的。 3 详细设计3.1 数据结构设计 struct xuekechar xueke_name50;int people_num;这是定义了一个xueke结构体,用来存放一个学科名及其相应的旷课人数;struct studentchar name50;long time;int lesson_time;char lesson_name50;int chidao_num;int zaotui_num;int qingjia_num;int kuangke_num;struct student *next;这是定义了一个student的结构体,用来存放一个学生的考勤记录,其中有,字符数组name50,lesson_name50,分别存放学生名字,缺课课程名字;int型变量lesson_time,chidao_num,zaotui_num,qingjia_num, kuangke_num,分别来存放,缺课节次,迟到次数,早退次数,请假次数,旷课次数 long型变量time,记录时间。 3.2 主模块设计3.2.1建立学生缺课记录子模块要建立的学生人数,学生基本信息(包括缺课时间、学生姓名、课程名称、节次、迟到次数、早退次数、请假次数、旷课次数)可用creat()函数如图1. 图13.2.2修改学生缺课记录子模块根据要修改的学生姓名以及科目名称找到相应的信息,再选择要修改的项目进行单项修改 如图2 图23.2.3修改学生缺课记录子模块根据人名可以查出该学生的所有缺课记录 如图3 图33.2.4查看单科旷课记录子模块根据学科名称和时间范围查出所有在该范围内旷课的学生以及次数 如图4 图43.2.5查看学生旷课记录子模块根据要查询的学科名称及时间段查出在改时间段内该门课上旷课的人数 如图5 图53.2.6载入学生旷课记录子模块可以载入实现储存在当前文件夹中txt文件中所储存的数据 如图6 图63.2.7储存学生旷课记录子模快进入系统界面,顺序的完成各项操作,进行数据的输入,信息的保存调用相应的函数打开相应的地址,查询各项信息。如图7 图7 4. 运行结果4.1运行开始菜单图1 开始菜单主菜单 图2 主菜单建立学生缺课记录图2建立学生缺课记录储存学生旷课记录图3储存学生旷课记录 5. 课程设计总结课程设计顺利完成,题目所要求的功能基本实现,可以对学生的缺课信息进行添加,修改,删除以及查询的显示。不过这个程序还不够完善,例如不能往当前文件夹中的txt文件中添加记录。结束语整个系统的设计过程对于我来说是个学习、探索的过程,通过借鉴别人,学习设计程序,在整个设计过程中,出现过很多的问题,很多繁琐的东西都需要反复的修改,主要是因为前期的学习不认真,对系统的需求分析的要求认识不清楚,使得在后边的工作中不得不经常反复请教别人去修改。使我体会到设置中每一步的重要性。所以在分析一个问题时,我们需要站在一个有远见的高度。通过此次设计,我对C+语言编程有了深刻的认识,积累了使用软件工程的思想来开发软件的经验,更重要的是学会了在对待问题时应该考虑到哪些方面和怎么解决问题。虽然时间紧迫但我学会了不少,感到自身知识的贫乏,希望在日后积极学习并尝试努力中能做出完善的系统。参考文献1谭浩强.C+语言程序设计.清华大学出版社2求是科技.Visual C+ 6.0信息系统开发.人民邮电出版社附录:源代码 #include /cstdio是将stdio.h的内容用C+头文件的形式表示出来#include #include /malloc的全称是memory allocation,中文叫动态内存分配,当无法知道内存具体位置的时候,想要绑定真正的内存空间,就需要用到动态的分配内存。#include /当调用库函数,客户程序提供的是string类型参数,而库函数内部实现用的是c-串,因此需要将string对象,转化为char*对象,而c_str()提供了这样一种方法,它返回一个客户程序可读不可改的指向字符数组的指针。#include /I/O流控制头文件#define NULL 0#define guding 10#define LEN sizeof(struct student)using namespace std;int student_num;FILE *fp1;struct xuekechar xueke_name50;int people_num;struct studentchar name50;long time;int lesson_time;char lesson_name50;int chidao_num;int zaotui_num;int qingjia_num;int kuangke_num;struct student *next;void chaxun(struct student *head)int i;char chaxun_name50;coutchaxun_name;struct student *p;if(head=NULL)cout联系人为空;p=head;for(i=0;iname)=0)cout缺课时间:time 学生姓名:name 课程名称:lesson_name 节次:lesson_timeendl 迟到次数:chidao_num 早退次数:zaotui_num 请假次数:qingjia_num 旷课次数:kuangke_numnext; struct student *xiugai(struct student *head)char xiugai_name50;char xiugai_xueke_name50;int k;coutxiugai_namexiugai_xueke_name;struct student *p1,*p2; p2=(struct student *)malloc(LEN);p1=head;if(head=NULL)coutname)!=0|strcmp(xiugai_xueke_name,p1-lesson_name)!=0)&(p1-next!=NULL)p1=p1-next; if(strcmp(xiugai_name,p1-name)=0&strcmp(xiugai_xueke_name,p1-lesson_name)=0) cout= 修改信息 =n; cout 1-修改缺课时间 n;cout 2-修改学生姓名 n;cout 3-修改课程名称 n;cout 4-修改第几节缺课 n;cout 5-修改迟到次数 n;cout 6-修改早退次数 n;cout 7-修改请假次数 n;cout 8-修改旷课次数 nn;coutk;switch(k)case 1:coutp1-time;break;case 2:coutp1-name;break;case 3:coutp1-lesson_name;break;case 4:coutp1-lesson_time;break;case 5:coutp1-chidao_num;break;case 6:coutp1-zaotui_num;break;case 7:coutp1-qingjia_num;break;case 8:coutp1-kuangke_num;break; return head;struct student *creat()int i,b;struct student *head,*p1,*p2; coutb;head=p2=NULL;p1=(struct student *)malloc(LEN);cout【输入格式:缺课时间(空格)学生姓名(空格)课程名称(空格)第几节(空格)迟到次数(空格)早退次数(空格)请假次数(空格)旷课次数】n;coutp1-timep1-namep1-lesson_namep1-lesson_timep1-chidao_nump1-zaotui_nump1-qingjia_nump1-kuangke_num;head=p1;p2=p1;student_num+=1;for(i=1;ib;i+)p1=(struct student*)malloc(LEN);cout请输入第i+1p1-timep1-namep1-lesson_namep1-lesson_timep1-chidao_nump1-zaotui_nump1-qingjia_nump1-kuangke_num;p2-next=p1;p2=p1;student_num+=1; p2-next=NULL; return head;void print(struct student *head)struct student *p;p=head;if(p=NULL)cout没有学生信息n;while(p!=NULL) cout缺课时间:time 学生姓名:setw(10)name 课程名称:lesson_name 节次:lesson_timeendl 迟到次数:chidao_num 早退次数:zaotui_num 请假次数:qingjia_num 旷课次数:kuangke_numnext;struct student *tongji_lesson(struct student *head)struct student *p1,*p2,*p3;char lesson50;long look_time1,look_time2;int xunhuan_num=0;p3=(struct student *)malloc(LEN);if(head=NULL)coutnext;while(xunhuan_numkuangke_nump1-kuangke_num)p3-chidao_num=p2-chidao_num;p3-kuangke_num=p2-kuangke_num;p3-qingjia_num=p2-qingjia_num;p3-zaotui_num=p2-zaotui_num;p3-lesson_time=p2-lesson_time;p3-time=p2-time;strcpy(p3-lesson_name,p2-lesson_name);strcpy(p3-name,p2-name);p2-chidao_num=p1-chidao_num;p2-kuangke_num=p1-kuangke_num;p2-qingjia_num=p1-qingjia_num;p2-zaotui_num=p1-zaotui_num;p2-lesson_time=p1-lesson_time;p2-time=p1-time;strcpy(p2-lesson_name,p1-lesson_name);strcpy(p2-name,p1-name);p1-chidao_num=p3-chidao_num;p1-kuangke_num=p3-kuangke_num;p1-qingjia_num=p3-qingjia_num;p1-zaotui_num=p3-zaotui_num; p1-lesson_time=p3-lesson_time;p1-time=p3-time;strcpy(p1-lesson_name,p3-lesson_name);strcpy(p1-name,p3-name);p1=p2;p2=p2-next;p1=head;p2=p1-next;xunhuan_num+;coutlesson;coutlook_time1look_time2;p1=head; while(p1!=NULL)if(strcmp(lesson,p1-lesson_name)=0&look_time1time&p1-time=look_time2)cout学生姓名:name 旷课次数:kuangke_numnext; return head;struct student *tongji_student(struct student *head) struct xueke a10;int n,i,j,zhongjian;struct student *p1;char zhongjian_name50;long look_time1,look_time2;if(head=NULL)cout没有学生信息n;return head; coutn;for(i=0;in;i+)cout请输入第i+1ai.xueke_name;ai.people_num=0; coutlook_time1look_time2;p1=head;for(i=0;in;i+)while(p1!=NULL&look_time1time&p1-timelesson_name)ai.people_num+=p1-kuangke_num; p1=p1-next;p1=head; for(j=0;jn-1;j+) for(i=0;in-1-j;i+)if(ai.people_num0) zhongjian=ai+1.people_num;ai+1.people_num=ai.people_num;ai.people_num=zhongjian;strcpy(zhongjian_name,ai+1.xueke_name);strcpy(ai+1.xueke_name,ai.xueke_name);strcpy(ai.xueke_name,zhongjian_name);for(i=0;in;i+)cout学科名称:ai.xueke_name 旷课次数:ai.people_numendl;return head;return head;struct student *zairu()struct student *p1=NULL,*p2=NULL,*head=NULL;struct student student_ziliao100;int i=0,n=0;if(fp1=fopen(xueshengziliao.txt,rb+)=NULL) printf(cannot open filen);return(head); while(!feof(fp1)if(fread(&student_ziliaoi,LEN,1,fp1)!=1)if(feof(fp1)fclose(fp1); break; printf(file read errorn);i+;n=i;student_num=n;p1=p2=(struct student *)malloc(LEN);head=p1;for(i=0;ichidao_num=student_ziliaoi.chidao_num;p1-kuangke_num=student_ziliaoi.kuangke_num;strcpy(p1-lesson_name,student_ziliaoi.lesson_name);p1-lesson_time=student_ziliaoi.lesson_time;strcpy(p1-name,student_);p1-qingjia_num=student_ziliaoi.qingjia_num;p1-time=student_ziliaoi.time;p1-zaotui_num=student_ziliaoi.z

温馨提示

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

评论

0/150

提交评论