*******************实践教学*******************兰州理工大学软件学院2013年秋季学期计算机应用基础课程设计题目:学生信息管理系统专业班级:软件1班姓名:陈静学号:13700146指导教师:任旭鹏成绩:_______________摘要此次我们设计的是《学生信息管理系统》,在程序中运行学生信息创建模块,列出模块,删除模块,查找模块,保存模块等,在程序中用到了选择结构,循环结构,结构体,数组,文件操作,自定义函数等。关键词:结构体;文件操作;数组;循环结构;选择结构;自定义函数目录1需求分析······································································································12总体设计······································································································12.1程序的总体设计·····················································································12.2数据结构······························································································23详细设计······································································································43.1主控模块设计························································································43.2列出模块······························································································54主要函数功能描述··························································································64.1主函数main()························································································64.2列出函数print_list()················································································75测试与调试···································································································86个人设计小结与心得体会················································································11参考文献········································································································11附件1程序源代码···························································································1111需求分析(1)问题根据需求,该系统所应包含的信息有以下一些:息学生的基本信:学号、姓名、性别、QQ、电话根据需求,该系统所应实现的功能有以下一些:各种基本数据的录入。如:学生基本信息录入。各种基本数据的修改。即:允许对已经录入的数据重新进行编辑、修改。例如修改学生信息中张三的电话信息各种基本数据的删除。例如将张三的信息从学生信息中删除基于各种数据的查询。例如输入学号1,查询学号为1的名字、性别、QQ和电话。各种基本信息的浏览。例如对保存的学生信息的浏览。(2)系统采用C语言实现,开发环境为VC,可以运行在操作系统windows98及以上皆可。(3)运行要求能不受限制的录入学生信息。界面友好,操作方便,例如删除前需要提示用户是否删除。容错性强,例如数据导出时,如果文件不存在需要提示用户。2总体设计2.1程序的总体设计在系统设计方面需采用模块化,把一个复杂的问题简单化,化成几个简单的模块来处理,.但是在划分的同时又必须要了解各自的功能,它们之间应该有自己的独立性,同时又存在相互的联系.通讯记录时以二进制的形式进行存储和输入,一般程序从整体到部分,先进行整体概括,然后在逐步细化完善本系统由一个图来表示为2图1系统总图本通讯管理系统可以概括的划分为以下几大模块:1输入创建模块2列出菜单模块3删除数据模块4修改数据模块5查找数据模块6插入数据模块7保存数据模块8退出系统2.2数据结构根据系统要求,系统中需要保存的数据学生的信息,其结构如下:数据项名称数据项系统表示数据类型数据长度备注学生学号numint学生姓名name[]char10学生QQqq[]char10学生性别sexint学生电话phoneint使用语言创建的结构体如下:#includestdio.h#includestdlib.h#includestring.hintnum;/*学生学号*/charname[10];/*学生姓名*/charqq[10];/*学生QQ*/intsex;/*学生性别*/intphone;/*学生电话*/主菜单创建删除列出保存插入查找修改退出3}LIST;LISTL[100];intmain(void){}voidrevise_list()/*自定义函数-修改数组*/{}voidprint_list()/*自定义函数-列出菜单*/{}voiddelete_list()/*自定义函数-删除文件*/{}voidinsert_list()/*自定义函数-创建文件*/{}voidfind_list()/*自定义函数-查找文件*/{}voidinto_list()/*自定义函数-插入文件*/{}voidsave_list()/*自定义函数-保存文件*/{}43详细设计3.1主控模块设计控制整个程序的运行,通过主函数模块分别调用各个模块,实现各项功能,流程如下图12345670图2主模块流程图调用子函数结束创建修改删除列出查找插入保存退出输入选择开始密码界面菜单界面5注释1主控是用switch多分支选择结构来实现功能选择3.2列出模块列出模块是通过循环结构变化个个列出数组自定义数组L[key]信息图3列出模块流程图i++结束输出一个记录ikeyinti;i=0开始64主要函数功能描述4.1主函数main()函数原型:#includestdio.h#includestdlib.h#includestring.h#defineEXIT-1#defineLENsizeof(structlist)intkey=0;/*stdlib-标准库头文件...sizeof-运算符...string-字符串...typedef-定义类型*/typedefstructlist{intnum;/*学生学号*/charname[10];/*学生姓名*/intqq;/*学生QQ*/charsex[10];/*学生性别*/longintphone;/*学生电话*/}LIST;LISTL[100];intmain(void)/*主函数*/{intchoice,y;printf(\t\t\t*********学生信息管理系统*********);printf(请输入密码:);scanf(%d,&y);if(y==123){do{printf(\n\n\n\t\t\t********学生信息管理系统********);printf(\n\t\t\t\t***********==**********\n);printf(\t\t\t\t1.*****创建*****\n);printf(\t\t\t\t2.*****列出*****\n);printf(\t\t\t\t3.*****删除*****\n);printf(\t\t\t\t4.*****修改*****\n);printf(\t\t\t\t5.*****查找*****\n);printf(\t\t\t\t6.*****插入*****\n);printf(\t\t\t\t7.*****保存*****\n);printf(\t\t\t\t0.*****退出*****\n);printf(\t\t\t\t请选择:);scanf(%d,&choice);switch(choice)7{case1:insert_list();break;case2:print_list();break;case3:delete_list();break;case4:revise_list();break;case5:find_list();break;case6:into_list();break;case7:save_list();break;case0:exit(0);default:printf(inputagain~\n);}}while(1);}elseprintf(密码错误!请重启程序!);fflush(stdin);getchar();return0;}功能描述:通过if选择结构实现加密正确输入密码后进入主菜单,否则提示“密码密码错误!请重启程”进入主菜单后用switch多分支选择结构来调用子函数来实现对学生信息的创建、修改、插入等。流程图如图2所示。4.2列出函数print_list()函数原型:voidprint_list()/*列出菜单*/{inti;for(i=0;ikey;i++){printf(学号\t姓名\tQQ号\t性别\t电话\t\n);printf(%d\t%s\t%d\t%s\t%d\n,L[i].num,L[i].name,L[i].qq,L[i].sex,L[i].phone);}if(key==0)printf(theshuzuisNULL!\n);}功能描述:通过for循环结构改变i的值调用L[i]保存的值逐个显示。流程图如图3所示85测试与调试1主程序测试测试数据:输入密码123图4测试结果:程序运行没有错误,如下图5菜单选项测试:输入数据请选择:19图6测试结果:程序运行没有错误,如下图72列出测试测试数据:输入2,如下10图8测试结果程序运行有错误,如下图9错误是性别、电话没有对其修改后如下图10116个人设计小结与心得体会为期一个星期的C语言实训结束了,在这一个星期内我的感触颇深。因为在写程序中实在是遇到了太多的困难了,这让我意识到自己对C语言知识的贫乏。我们只学会了简单的指针和函数,这些应付考试是绝对没有问题了的,然而应用在实际的程序设计当中却是远远不够的。可想而知,验收过程很不满意,这让我觉得很对不起老师的一番含辛茹苦。所以哪怕我的验收过程不是很理想都好,我交实训报告的时候也一定要把这个学生信息管理系统理解透彻!在整个编程过程中,我坚持虚心的向同学请教问题,同时自己也在网上查找各种信息,通过不断地改正,我终于知道编好一个完美的程序是多么的不容易啊!!同时,在不断的犯错中,我也了解了许多以前不知道的东西。做得不好的,也请老师多多见谅,以后我一定