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

上传人:小飞机 文档编号:3153740 上传时间:2023-03-11 格式:DOCX 页数:25 大小:43.53KB
返回 下载 相关 举报
c++课程设计学生考勤管理系统报告 .docx_第1页
第1页 / 共25页
c++课程设计学生考勤管理系统报告 .docx_第2页
第2页 / 共25页
c++课程设计学生考勤管理系统报告 .docx_第3页
第3页 / 共25页
c++课程设计学生考勤管理系统报告 .docx_第4页
第4页 / 共25页
c++课程设计学生考勤管理系统报告 .docx_第5页
第5页 / 共25页
亲,该文档总共25页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《c++课程设计学生考勤管理系统报告 .docx》由会员分享,可在线阅读,更多相关《c++课程设计学生考勤管理系统报告 .docx(25页珍藏版)》请在三一办公上搜索。

1、c+课程设计学生考勤管理系统报告 学生考勤管理系统 2 总体设计 2.1功能模块设计 根据分析整个系统主要划分为7个功能模块,分别执行要求中的功能。数据管理中可以对学生的基本信息、课程的基本信息、学生缺课的查询、添加、删除和修改。查询管理通过根据学生姓名,课程姓名 时间段儿等信息,查询单个学生的缺课记录,单科课的旷课记录,单个学生的旷课记录。功能模块图如图1所示: 学生考勤管理程序建立学生缺课记录图1功能模块图 修改学生缺课记录查询学生缺课记录查看单科旷课记录查看学生旷课记录载入学生旷课记录储存学生旷课记录2.2系统设计方案 这个程序是过程性语言设计的。运用多种条件语句,主体采用的是链表指针。

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

3、若干个函数组成的,保存和读取函数是和其他函数互相调用的。 学生考勤管理系统 3 详细设计 3.1 数据结构设计 struct xueke char 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 *

4、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. - 1 - 学生考勤管理系统 开始int i,b;struct student *he

5、ad,*p1,*p2; printf(请输入要建立资料的学生人数:);scanf(%d,&b);head=p2=NULL;p1=(struct student *)malloc(LEN);输入第一个学生成绩head=p1;p2=p1;i=0;student_num+;inext=p1;p2=p1;student_num+;i+p2-next=NULL结束 图1 3.2.2修改学生缺课记录子模块 根据要修改的学生姓名以及科目名称找到相应的信息,再选择要修改的项目进行单项修 - 2 - 学生考勤管理系统 开始char xiugai_name50;char xiugai_xueke_name50;i

6、nt 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-p1=p1-next;name)!=0&(p1-next!=NULL)&strcmp(xiugai_xueke_name,p1-lesson_name)!strcmp(xiugai_name,p1-name)=0&strcmp(xiugai_xueke_name,p1-les

7、son_name)=0显示修改菜单选择修改项目并完成修改结束改 如图2 图2 3.2.3修改学生缺课记录子模块 根据人名可以查出该学生的所有缺课记录 如图3 - 3 - 学生考勤管理系统 开始int i=0;char chaxun_name50;struct student *p;p=head;printf(请输入要查询的人名:); scanf(%s,chaxun_name);iname)=0输出p所指向的结构体数据结束 图3 3.2.4查看单科旷课记录子模块 根据学科名称和时间范围查出所有在该范围内旷课的学生以及次数 如图4 - 4 - 学生考勤管理系统 开始struct student *

8、p1,*p2,*p3; char lesson50;long look_time1,look_time2;int xunhuan_num=0;p3=(struct student *)malloc(LEN);p1=head;p2=p1-nextxunhuan_numkuangke_nump1-kuangke_numYp1=head;p2=p1-next;p1=p2;交换p1与p2指向数xunhuan_num+;p2=p2-next;据printf(请输入要查看的学科名称:);scanf(%s,lesson);printf(请输入要查看的时间范围); scanf(%ld%ld,&look_tim

9、e1,&look_time2);p1=head;p1!=NULLstrcmp(lesson,p1-lesson_name)=0&look_tp1=p1-next;ime1time&p1-time=look_time2输出学生姓名和旷课次数结束 图4 3.2.5查看学生旷课记录子模块 根据要查询的学科名称及时间段查出在改时间段内该门课上旷课的人数 如图5 - 5 - 学生考勤管理系统 开始int n,i,j,zhongjian;struct student *p1;char zhongjian_name50;long look_time1,look_time2;printf(请输入第%d个学科名

10、称:,i+1);scanf(%s,ai.xueke_name);ai.people_num=0;printf(请输入要查看的时间范围由小到大);scanf(%ld%ld,&look_time1,&look_time2);p1=head;i=0;YinNNp1!=NULL & look_time1time & p1-timenext;N(strcmp(ai.xueke_name,p1-lesson_name)=0Yai.people_num+=p1-kuangke_num;Yjn-1Yin-1-jNNNai.people_numnext;结束图7Y- 8 - 学生考勤管理系统 4. 运行结果 4

11、.1运行 开始菜单 图1 开始菜单 - 9 - 学生考勤管理系统 主菜单 图2 主菜单 建立学生缺课记录 - 10 - 学生考勤管理系统 图2建立学生缺课记录 储存学生旷课记录 图3储存学生旷课记录 5. 课程设计总结 课程设计顺利完成,题目所要求的功能基本实现,可以对学生的缺课信息进行添加,修改,删除以及查询的显示。不过这个程序还不够完善,例如不能往当前文件夹中的txt文件中添加记录。 结束语 整个系统的设计过程对于我来说是个学习、探索的过程,通过借鉴别人,学习设计程序,在整个设计过程中,出现过很多的问题,很多繁琐的东西都需要反复的修改,主要是因为前期的学习不认真,对系统的需求分析的要求认识

12、不清楚,使得在后边的工作中不得不经常反- 11 - 学生考勤管理系统 复请教别人去修改。使我体会到设置中每一步的重要性。所以在分析一个问题时,我们需要站在一个有远见的高度。 通过此次设计,我对C+语言编程有了深刻的认识,积累了使用软件工程的思想来开发软件的经验,更重要的是学会了在对待问题时应该考虑到哪些方面和怎么解决问题。 虽然时间紧迫但我学会了不少,感到自身知识的贫乏,希望在日后积极学习并尝试努力中能做出完善的系统。 参考文献 谭浩强.C+语言程序设计.清华大学出版社 求是科技.Visual C+ 6.0信息系统开发.人民邮电出版社 附录:源代码 #include /cstdio是将stdi

13、o.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

14、 sizeof(struct student) using namespace std; int student_num; FILE *fp1; struct xueke char xueke_name50; int people_num; ; struct student char name50; long time; int lesson_time; char lesson_name50; int chidao_num; int zaotui_num; int qingjia_num; - 12 - 学生考勤管理系统 int kuangke_num; struct student *nex

15、t; ; 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 *

16、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_

17、name,p1-name)=0&strcmp(xiugai_xueke_name,p1-lesson_name)=0) cout= 修改信息 =n; - 13 - 学生考勤管理系统 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

18、; case 3: coutp1-lesson_name; break; case 4: coutp1-lesson_time; break; case 5: coutp1-chidao_num; break; case 6: coutp1-zaotui_num; - 14 - 学生考勤管理系统 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;

19、coutb; head=p2=NULL; p1=(struct student *)malloc(LEN); coutn; 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-

20、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) - 15 - 学生考勤管理系统 struct student *p; p=head; if(p=NULL) cout没有学生信息n; while(p!=NULL) cout缺课时间:time 学生姓名:setw(10)name 课程名称:lesson_name 节次:lesson_timeendl 迟到

21、次数: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-k

22、uangke_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_n

23、um; p2-qingjia_num=p1-qingjia_num; p2-zaotui_num=p1-zaotui_num; p2-lesson_time=p1-lesson_time; p2-time=p1-time; 旷- 16 - 学生考勤管理系统 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

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

25、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; - 17 - 学生考勤管理系统 for(i=0;in;i+

26、) 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.pe

27、ople_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

28、=NULL; struct student student_ziliao100; int i=0,n=0; - 18 - 学生考勤管理系统 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

29、=(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_ziliaoi.name); p1-qingjia_num=student_ziliaoi.qi

30、ngjia_num; p1-time=student_ziliaoi.time; p1-zaotui_num=student_ziliaoi.zaotui_num; p2-next=p1; p2=p1; p1=(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; - 19 - 学生考勤管理系统 zhuye: cout$ 欢迎使用学生考勤管理系统 V1.0.0 $n; cout 1_进入管理nnn; cout 2_查看系统相关信息nnn; couta; if(a=1) do cout*n; cout 1_建立学生缺课记录n; cout 2_修改学生缺课记录n; cout

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号