c语言课程设计报告学生成绩信息管理系统源代码

上传人:小** 文档编号:76988625 上传时间:2022-04-19 格式:DOC 页数:17 大小:237KB
返回 下载 相关 举报
c语言课程设计报告学生成绩信息管理系统源代码_第1页
第1页 / 共17页
c语言课程设计报告学生成绩信息管理系统源代码_第2页
第2页 / 共17页
c语言课程设计报告学生成绩信息管理系统源代码_第3页
第3页 / 共17页
点击查看更多>>
资源描述
实验报告一、问题陈述及其需求分析(一)问题陈述学生信息管理系统是对学生信息的基本管理,其中包括以下及模块:(1) 增加一个学生的信息(需输入要增加学生的所有信息);(2)统计本班学生总人数及男女生人数。(3)分别按照学号查找学生的信息;若找到则输出该学生全部信息,否则输出 查找不到的提示信息。(4)按学号对所有学生信息排序,并输出结果;(5)删除一个学生的信息(需指定要删除学生的学号);同时显示删除后的结果(二)功能需求分析学生信息管理系统设计学生信息包括:学号,姓名,性别,出生年月,电话使之提供以下功能:1、系统以菜单方式工作2、建立链表并显示3、插入新的学生信息4、删除某学号的学生信息5、查找某学号的学生信息6对学生信息排序7、统计学生人数8、输出学生信息二总体设计(一)模块依据程序的数据结构,描述该程序的层次结构,如下图:mai n()Ir菜单函勺数1建立链表并显示8学生信息写入文件o退出1、建立链表并显示void createlist(struct stucode *r);2、插入新的学生信息void in sert(struct stucode *r);3、删除某学号的学生信息void del(struct stucode *r);4、查找某学号的学生信息void search1(struct stucode *r);5、对学生信息排序void sort(struct stucode *r);6、统计学生人数void search2(struct stucode *r);7、输出学生信息void out(struct stucode *r);(二)程序总体框架模块层次结构,只确定了模块之间的关系和函数原型,不是程序的执行步骤。 程序总体框架是该程序的总体流程图。 改程序不是顺序连续地执行全部功能, 而 是在某一时刻有选择地执行一种或多种功能。因此选用菜单方式是较佳的方案, 程序总体框架如下图:mai n()V1建立链表并显示2添加学生信息3删除学生信息自心4按学号查找学生5对学生信息排序6统计学生人数7输出学员信息息8学生信息写入亠O退出菜单1输入2输出3排序4添加5删除6、统计7查询8退出(三)运行环境(软,硬件环境)硬件:CPU,内存,主板,硬盘,显卡,键盘,显示器等等。软件:Windows XP trubo c应用软件。(四)开发工具和编程语言开发工具:trubo c编程语言:C语言三、详细设计(一)数据结构依据给定学生信息和数据格式,数组用结构体实现,结构体层次结构:struct stud学号 整型long int num;姓名字符串n ame20;性别 字符串sex2;出生日期字符串birthday12;联系方式 字符串tel12;;头文件#i nclude#i nclude#i ncludevstri ng.h/*定义数据结构和链表*/struct studlong num;char n ame20;char sex2;char birthday12;char tel12;typedef struct stucodestruct stud stude nt ;struct stucode *n ext;L;(二八算法说明1、主函数的算法设计:清屏、显示子菜单及运用选择操作(运用swith语句),调用各个子函数,最后退出程序,主要代码:while(flag)system(cls);menu();choose=getchar();switch(choose)2、各个子函数的算法设计1、一些显示操作,输入相应的内容即可代码:2、创建链表并显示学生信息申请空间 p=(L *)malloc(sizeof(L);学生信息的输入及显示:p-stude nt. num=n;strcpy(p-stude nt. name,a);p-n ext=NULL;3、学生信息的删除首先查询要删除的学生信息的学号,如果存在删除该学生,如果不存在给予 相应的提示。t=p-n ext;p-n ext=p-n ext- n ext;free(t);/释放空间4、学生信息的排序新建链接,然后按要求对学生信息进行排序while(z-n ext&z-n ext-stude nt.num =p-stude nt. num)z=z-n ext;p-n ext=z-n ext;z-n ext=p;5、学生人数的统计:6、学生信息的显示:直接发调用函数即可。四、运行结果五、总结1、调试分析(1)刚编译完后有好多错误和警告,运行失败,然后经过修改错误警告慢慢减 少,最终可以运行。(2)该程序中可能还存在一些小问题,比如有的时候它会主动清屏,有的时候不会。并且我在编译的过程中发现自己存在好多毛病,有粗心了等,不注意细节,其实自己也知道细节决定成败,以后我会注意。2、设计总结经过一周的课程设计,我学到了很多东西: 巩固和加深了对数据结构的理解,提高综合运用本课程所学知识的能力。 培养了我选用参考书,查阅手册及文献资料的能力。培养独立思考,深入研究, 分析问题、解决问题的能力。 过实际编译系统的分析设计、编程调试,掌握应用软件的分析方法和工程设计 方法。 够按要求编写课程设计报告书,能正确阐述设计和实验结果,正确绘制系统和 程序框图。 通过课程设计,培养了我严肃认真的工作作风,逐步建立正确的生产观念、经 济观念和全局观念。课程设计是把我们所学的理论知识进行系统的总结并应用于实践的良好机 会,有利于加强我们用知识理论来分析实际问题的能力,进而加强了我们对知识 认识的实践度,巩固了我们的理论知识,深化了对知识的认识,并为走向社会打 下一个良好的基础。在这次课程设计中我遇到许多问题和麻烦, 得到了老师的帮助和指导,才能 够使得这次课程设计顺利的进行下去, 另外,在程序调试过程中,也得到很多同 学的帮助,给我及时指出错误,提出许多宝贵意见。在此对老师和同学们表示感 谢!六、参考文献书籍:谭浩强 C程序设计(第三版)北京清华大学出版社谭浩强 C程序设计题解与上机指导(第三版)北京 清华大学出版社王为青 刘变红 C语言高级编程及实例剖析人民邮电出版社张建勋 C语言程序设计教程清华大学出版社李玲 桂玮珍 刘莲英 C语言程序设计教程习题解答与实验指导人民邮电出版社源程序:#i nclude#in clude#i ncludevstri ng.hstruct studlong num;char n ame20;char sex2;7char birthday12;char tel12;;typedef struct stucodestruct stud stude nt ;struct stucode *n ext;L;void menu();void createlist(struct stucode *r);void out(struct stucode *r);void search1(struct stucode *r);void search2(struct stucode *r);void del(struct stucode *r);void in sert(struct stucode *r);void sort(struct stucode *r);void mai n()char choose;int flag=1;struct stucode *r=NULL;while(flag)system(cls);menu();switch(choose)case 1:createlist(&r);out(r);prin tf(Testi ng fun cti on 1n Press any key to continued); getchar();getchar();break;case 2:search1(r);prin tf(Testi ng fun cti on 1n Press any key to continued);getchar();getchar();break;case 3:search2(r);prin tf(Testi ng fun cti on 1n Press any key to continued);getchar();getchar();break;case 4:del(&r);out(r);prin tf(Testi ng fun cti on 1n Press any key to continued); getchar();break;case 5:in sert(&r);out(r);prin tf(Testi ng fun cti on 1n Press any key to continued);getchar();getchar();break;case 6:sort(&r);out(r);prin tf(Testi ng fun cti on 1n Press any key to continued);getchar();getchar();break;case 7:out(r);prin tf(Testi ng fun cti on 7n Press any key to continued);getchar();getchar();break;case O:flag=0;prin tf(The en d.n);getchar();getchar();10break;default: printf(nWrong Selection!(选择错误,请重选!)n);getchar(); getchar();void createlist(struct stucode *r)struct stucode *p,*t;long n;char a20;char s4;char b12;char m12;if(*r) *r=NULL;电话printf( n请输入:n学号(请按学号升序排列)姓名 性别 出生日期(若要结束请输入五个为零)n);sca nf(%ld%s%s%s%s,&n ,a,s,b,m);if(n=0) retur n;p=(L *)malloc(sizeof(L);p-stude nt. num=n;strcpy(p-stude nt. name,a);strcpy(p-stude nt.sex,s);strcpy(p-stude nt.birthday,b);strcpy(p-stude nt.tel,m);p- next=NULL;*r=p;sca nf(%ld%s%s%s%s,&n ,a,s,b,m);while( n)t=p;p=(L *)malloc(sizeof(L);p-stude nt. num=n;strcpy(p-stude nt. name,a);strcpy(p-stude nt.sex,s);strcpy(p-stude nt.birthday,b);strcpy(p-stude nt.tel,m);p- next=NULL;t-n ext=p;sca nf(%ld%s%s%s%s,&n ,a,s,b,m);void search1(struct stucode *r)long x;if(!r)printf(没有学生信息可查询!n);return ;:n);printf(请输入要查询的学生信息的学生学号sca nf(%ld, &x);while(r&r-stude nt. nu m!=x)r=r-n ext;if(r=NULL)prin tf(Error! No such stude nt !n);else prin tf(%ld %s %s %s %sn ,r-stude nt. num ,r-stude nt.n ame,r-stude nt.sex,r-stude n t.birthday,r-stude nt.tel);void search2(struct stucode *r)int a=0,b=0,c=0;if(!r)printf(没有学生信息可统计!n);return ;elsewhile(r)a+;if(strcmp(r-stude nt.sex,男)=0)b+;if(strcmp(r-stude nt.sex,女)=0)c+;r=r-n ext;printf(共有学生%d人,其中男生%d人,女生%d人,a,b,c);void del(struct stucode *r)long k;struct stucode *p=*r,*t;if(!(*r)printf(没有学生信息可删除!n);return ;printf(请输入要删除的学生信息的学生学号:n);sea nf(%ld,&k);if(p-stude nt. num=k)*r=(*r)-n ext,free(p);elsewhile(p-n ext&p-n ext-stude nt. nu m!=k) p=p-n ext;if(p- next=NULL)prin tf(Error! No such stude nt !n);elset=p-n ext;p-n ext=p-n ext- n ext;free(t);void in sert(struct stucode *r)long n;char a20;char s4;char b12;char m12;L *p,*t,*k;电话printf( n请输入:n学号(请按学号升序排列)姓名 性别 出生日期(若要结束请输入三个为零)n);sea nf(%ld%s%s%s%s,&n ,a,s,b,m);p=(L *)malloc(sizeof(L);p-stude nt. num=n;strcpy(p-stude nt. name,a);strcpy(p-stude nt.sex,s);strcpy(p-stude nt.birthday,b);strcpy(p-stude nt.tel,m);if(!(*r)*r=p;(*r)- next=NULL;return ;if(p-stude nt. num v(*r)-stude nt. num)p-n ext=(*r),(*r)=p;else t=*r;k=t;while(t- n ext&t- n ext-stude nt. num v=p-stude nt. num) t=t- n ext;p-n ext=t- n ext; t-n ext=p;*r=k; void sort(struct stucode *r)struct stucode *t,*p,*q,*z;if(!r)printf(没有学生信息可排序!n);return ; if(!(*r)|!(*r)- next)return;t=*r;p=t- n ext;t- next=NULL;while(p)q=p-n ext;if(p-stude nt.num t-stude nt.num)p-n ext=t;t=p;elsez=t;while(z-next&z-n ext-stude nt. num =p-stude nt. num)z=z-n ext;p-n ext=z-n ext;z-n ext=p;p=q;*r=t;void out(struct stucode *r)prin tf(nn);if(!r)printf(没有学生信息可输出!n);return ;while(r)prin tf(%ld %s %s %s %sn ,r-stude nt. num ,r-stude nt.n ame,r-stude nt.sex,r-stude n t.birthday,r-stude nt.tel);r=r-n ext;prin tf(nn);void menu()printf(n学生信息管理系统n);printf(n 菜单nn);printf(n 1建立链表并显示n);printf(n 2查找某学号的学生信息n); printf(n 3查找某姓名的学生信息n); printf(n 4删除某学号的学生信息n); printf(n 5插入新的学生信息n);printf(n 6按学号降序排列输出n); printf(n 7 输出 n);printf(n 0 退出 n);printf(n请选择您要执行的选项:n);17
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 解决方案


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

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


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