c++课程设计学生考勤管理系统报告

上传人:Sc****h 文档编号:148148761 上传时间:2022-09-04 格式:DOC 页数:16 大小:270KB
收藏 版权申诉 举报 下载
c++课程设计学生考勤管理系统报告_第1页
第1页 / 共16页
c++课程设计学生考勤管理系统报告_第2页
第2页 / 共16页
c++课程设计学生考勤管理系统报告_第3页
第3页 / 共16页
资源描述:

《c++课程设计学生考勤管理系统报告》由会员分享,可在线阅读,更多相关《c++课程设计学生考勤管理系统报告(16页珍藏版)》请在装配图网上搜索。

1、信息科学与技术学院程序设计基础课程设计报告题目名称:学生考勤管理系统学生姓名:郭晨晨学号:2专业班级:13级计科( 3)班指导教师:郭理2013年6月6日目录目录 .1.课程设计题目与要求.1.1课题目的和要求 .1.3课题意义 .2总体设计 .2.1 功能模块设计 .2.2系统设计方案 .3详细设计 .3.1数据结构设计 .3.2主模块设计 .3.2.1建立学生缺课记录子模块 .3.2.2修改学生缺课记录子模块 .3.2.3修改学生缺课记录子模块 .3.2.4查看单科旷课记录子模块 .3.2.5查看学生旷课记录子模块 .3.2.6载入学生旷课记录子模块 .3.2.7储存学生旷课记录子模快 .

2、4.运行结果 .4.1 运行 .5.课程设计总结 .结束语 .参考文献 .附录:源代码.1.课程设计题目与要求1.1课题目的和要求设计目的:要求实现- “学生考勤管理程序”记录学生的缺课情况,它包括:缺课日期、第几节课、课程名称、学生姓名、缺课类型(迟到、早退、请假及旷课)。1.2设计要求:1. 录入学生的缺课记录;2修改某个学生的缺课记录;3查询某个学生的缺课情况;4统计某段时间内,某门课旷课学生姓名及旷课次数,按旷课次数由多到少排序;5统计某段时间内,有学生旷课的课程及旷课人次,按旷课人次由多到少排序;6. 系统以菜单方式工作。1.3课题意义程序实践是本科生重要教学环节之一。通过程序实践,

3、强化学生的计算机应用技能,使学生验证、巩固和充实所学的理论知识,加深对相关内容的理解,拓宽知识面,培养学生的创新精神和实践能力学生考勤管理程序可以大大减缓学生考勤人员的工作量,方便了平时上课学生的出勤率的管理。2总体设计2.1 功能模块设计根据分析整个系统主要划分为 7 个功能模块,分别执行要求中的功能。数据管理中可以对学生的基本信息、课程的基本信息、学生缺课的查询、添加、删除和修改。查询管理通过根据学生姓名,课程姓名时间段儿等信息,查询单个学生的缺课记录,单科课的旷课记录,单个学生的旷课记录。功能模块图如图1 所示:图 1 功能模块图2.2 系统设计方案这个程序是过程性语言设计的。运用多种条

4、件语句,主体采用的是链表指针。系统的设计采用了数组语句、选择语句和循环语句, 在需要处理大量同类数据时, 这样就使程序书写更加简洁。程序使用了布尔函数。选择语句多采用if多分支选择结构与 switch语句。首先计算switch表达式,然后在caes 子句中寻找值相等的常量表达式, 并以此为入口符号, 由此开始顺序执行。 循环语句采用了for语句等、do-while语句, for 语句用于已知循环次数的循环结构,括号中的三个量分别用来表示循环变量初值、循环终值和循环增量。do-while语句先循环后判断,Break语句在switch语句中,保证多分支情况的正确执行,在循环语句中,强制终止本层循环

5、。保存和读取函数是典型的函数功能,一个程序是由若干个函数组成的,保存和读取函数是和其他函数互相调用的。3 详细设计3.1数据结构设计struct xuekechar xueke_name50;int people_num;这是定义了一个xueke 结构体,用来存放一个学科名及其相应的旷课人数;struct student char name50; long time;int lesson_time;char lesson_name50; int chidao_num;int zaotui_num; int qingjia_num; int kuangke_num;struct student

6、*next; 这是定义了一个student的结构体,用来存放一个学生的考勤记录,其中有,字符数组name50 , lesson_name50,分别存放学生名字,缺课课程名字; int型变量 lesson_time,chidao_num,zaotui_num,qingjia_num,kuangke_num,分别来存放,缺课节次,迟到次数,早退次数,请假次数,旷课次数long 型变量 time ,记录时间。3.2主模块设计要建立的学生人数,学生基本信息(包括缺课时间、学生姓名、课程名称、节次、迟到次数、早退次数、请假次数、旷课次数)可用creat ()函数如图1.图 1根据要修改的学生姓名以及科目

7、名称找到相应的信息,再选择要修改的项目进开始char xiugai_name50;char xiugai_xueke_name50;int k;printf( 请输入要修改的学生姓名与学科名称:);scanf(%s%s,xiugai_name,xiugai_xueke_name);struct student *p1,*p2;p2=(struct student *)malloc(LEN);p1=head;strcmp(xiugai_name,p1-name)!=0&(p1-p1=p1-next;next!=NULL)&strcmp(xiugai_xueke_name,p1-lesson_na

8、me)!strcmp(xiugai_name,p1-name)=0&strcmp(xiugai_xueke_name,p1-lesson_name)=0显示修改菜单选择修改项目并完成修改结束行单项修改如图2图2根据人名可以查出该学生的所有缺课记录如图3图3根据学科名称和时间范围查出所有在该范围内旷课的学生以及次数如图 4图 4根据要查询的学科名称及时间段查出在改时间段内该门课上旷课的人数如图5图 5可以载入实现储存在当前文件夹中txt文件中所储存的数据如图 6开始struct student *p1=NULL,*p2=NULL,*head=NULL;struct student student

9、_ziliao100;int i=0,n=0;打开文件!feof(fp1)将文件里的数据存入结构体数组通过结构体数组建立链表结束图 6进入系统界面,顺序的完成各项操作,进行数据的输入,信息的保存调用相应的函数打开相应的地址,查询各项信息。如图 7图 74.运行结果4.1 运行开始菜单图 1开始菜单主菜单图2主菜单建立学生缺课记录图 2 建立学生缺课记录储存学生旷课记录图 3 储存学生旷课记录5.课程设计总结课程设计顺利完成,题目所要求的功能基本实现,可以对学生的缺课信息进行添加,修改,删除以及查询的显示。不过这个程序还不够完善,例如不能往当前文件夹中的 txt 文件中添加记录。结束语整个系统的

10、设计过程对于我来说是个学习、探索的过程,通过借鉴别人,学习设计程序,在整个设计过程中,出现过很多的问题,很多繁琐的东西都需要反复的修改,主要是因为前期的学习不认真,对系统的需求分析的要求认识不清楚,使得在后边的工作中不得不经常反复请教别人去修改。使我体会到设置中每一步的重要性。所以在分析一个问题时,我们需要站在一个有远见的高度。通过此次设计,我对C+语言编程有了深刻的认识,积累了使用软件工程的思想来开发软件的经验,更重要的是学会了在对待问题时应该考虑到哪些方面和怎么解决问题。虽然时间紧迫但我学会了不少, 感到自身知识的贫乏, 希望在日后积极学习并尝试努力中能做出完善的系统。参考文献谭浩强 .C

11、+语言程序设计 . 清华大学出版社求是科技 .Visual C+ 6.0信息系统开发 . 人民邮电出版社附录:源代码#include/cstdio 是将 stdio.h 的内容用 C+ 头文件的形式表示出来#include#include/malloc 的全称是 memory allocation ,中文叫 动态内存 分配,当无法知道内存具体位置的时候,想要绑定真正的内存空间,就需要用到动态的分配内存。#include/当调用库函数,客户程序提供的是string类型参数,而库函数内部实现用的是c-串,因此需要将string对象,转化为char* 对象,而c_str()提供了这样一种方法,它返回

12、一个客户程序可读不可改的指向字符数组的指针。#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 student char name50; long time;int lesson_time;char lesson_name50; int chidao_num;int zaotui_num

13、; 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请假次数 :qingji

14、a_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

15、-next!=NULL)p1=p1-next;if(strcmp(xiugai_name,p1-name)=0&strcmp(xiugai_xueke_name,p1-lesson_name)=0)cout=修改信息=n;cout1- 修改缺课时间n;cout2-修改学生姓名n;n;cout3- 修改课程名称cout4- 修改第几节缺课n;cout5- 修改迟到次数n;cout6-修改早退次数n;cout7-修改请假次数n;cout8-修改旷课次数nn;coutk;switch(k)case 1:coutp1-time;break;case 2:coutp1-name;break;case 3

16、: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 *)mal

17、loc(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+1

18、p1-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 没有学生信息while(p!=NULL)n;cout缺课 时间 :time学生姓名 :setw(10)name课程名称 :lesson_name节

19、次 :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(xun

20、huan_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_n

21、um=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;

22、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旷课

23、次数: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;coutlo

24、ok_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

25、.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(x

26、ueshengziliao.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-kua

27、ngke_num=student_ziliaoi.kuangke_num; strcpy(p1-lesson_name,student_ziliaoi.lesson_name);p1-lesson_time=student_ziliaoi.lesson_time;strcpy(p1-name,student_ziliaoi.name);p1-qingjia_num=student_ziliaoi.qingjia_num;p1-time=student_ziliaoi.time;p1-zaotui_num=student_ziliaoi.zaotui_num;p2-next=p1;p2=p1;p

28、1=(struct student*)malloc(LEN); p2-next=NULL;return(head);void chucun(struct student *head) struct student *p1; p1=head;fp1=fopen(xueshengziliao.txt,wb+);while(p1!=NULL)fwrite(p1,LEN,1,fp1);p1=p1-next; fclose(fp1);cout储存成功 n;void main()struct student *head;int a,b,c;zhuye: cout$欢迎使用学生考勤管理系统$n;cout1_

29、进入管理 nnn;cout2_查看系统相关信息 nnn;couta;if(a=1)docout*n;cout1_建立学生缺课记录 n;cout2_修改学生缺课记录 n;cout3_查询学生缺课记录 n;cout4_查看单科旷课记录 n;cout5_查看学生旷课记录 n;cout6_载入学生旷课记录 n;cout7_储存学生旷课记录 n;cout8_退出考勤管理程序coutb;switch(b)case 1:head=creat();print(head);break;case 2:head=xiugai(head);print(head);break;case 3:chaxun(head);break;case 4:head=tongji_lesson(head);break;case 5:head=tongji_student(head);break;case 6:head=zairu();print(head);break;case 7:chucun(head);break;while(b!=8);n;elsecout*欢迎使用本系统*n;coutc;if(c=1)goto zhuye;

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

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!