教学信息管理系统c语言课程设计报告.doc

上传人:小飞机 文档编号:3900999 上传时间:2023-03-26 格式:DOC 页数:42 大小:330.50KB
返回 下载 相关 举报
教学信息管理系统c语言课程设计报告.doc_第1页
第1页 / 共42页
教学信息管理系统c语言课程设计报告.doc_第2页
第2页 / 共42页
教学信息管理系统c语言课程设计报告.doc_第3页
第3页 / 共42页
教学信息管理系统c语言课程设计报告.doc_第4页
第4页 / 共42页
教学信息管理系统c语言课程设计报告.doc_第5页
第5页 / 共42页
点击查看更多>>
资源描述

《教学信息管理系统c语言课程设计报告.doc》由会员分享,可在线阅读,更多相关《教学信息管理系统c语言课程设计报告.doc(42页珍藏版)》请在三一办公上搜索。

1、教学信息管理系统c语言课程设计报告程序设计基础课程设计报告题目:学院教学信息管理系统 日期:2012.5.21班级:计算机应用技术1102班 学号:姓名: 一 设计目的本课程设计是计算机科学与技术专业重要的实践性环节之一,是在学生学习完程序设计基础(C语言)课程后进行的一次全面的综合练习。本课程设计的目的:1. 巩固和加深学生对C语言课程的基本知识的理解和掌握2. 掌握C语言编程和程序调试的基本技能3. 利用C语言进行基本的软件设计4. 掌握书写程序设计说明文档的能力5. 提高运用C语言解决实际问题的能力二课程设计任务书题目:学院教学信息管理系统学院教学信息管理系统,每一条记录包括一位教师的职

2、工号、姓名、职称、性别、3门课程教学效果、综合评分。系统要求实现以下功能:1、输入:输入每一位教师记录,将其信息写入文件中。2、显示:显示每位教师记录。3、排序:按职工号或教学效果综合评分进行排序,并显示。4、查找:完成按姓名或职工号查找教师的相关记录,并显示。分步实施:1、初步完成总体设计,搭好框架,确定人机对话的界面,确定函数个数。2、建立一个文件,将每位教师的相关(教学)信息写入文件中并能显示于屏幕上。3、完成排序(按职工号、姓名、职称等)、查找等功能。要求:1、用C语言实现程序设计;2、利用结构体数组或者链表实现教师信息的数据结构设计;3、系统的各个功能模块要求用函数实现;4、界面友好

3、(良好的人机交互),程序加必要的注释。三系统设计方案用到数据结构的定义:在此程序中用到了结构体的定义,结构体数组的定义以及变量的申明,还用到了外部函数的申明及调用。在主函数中,输出教师信息的函数是贯穿在程序始终的,例如要实现教师的排序这一模块时,排完序后就需要用输出信息的函数来输出排序后的信息。这就得需要多个函数共同实现这一个模块。此程序的流程:由于系统需要实现返回主界面的功能,那么在程序的开头就需要使用do.while语句,在do.while语句内首先将系统的主界面写下来,然后又要根据不同的按键实现排序、查找、结束等功能,这就必须使用switch语句来实现,由于实现一个功能后,还需要跳出此功

4、能进入下一个功能,这样就要需要使用while语句来循环,直到用户需要返回主界面时就设定一个条件跳出while语句。程序流程图 : 四调试分析(1)遇到的问题如何解决:在调试程序的过程中,遇到的问题有些是我和老师交流过才解决的,但大部分都是自己通过思考并仔细推敲书本的程序后才解决了调试过程中出现的问题。(2)程序算法的改进设想;我觉得在两个数进行交换的算法中,应该有更简便的算法。(3)经验:通过这次课程设计,我知道了读写文件的方法,还知道了一些细节问题,如:如果要在键盘中输入一个字符时,需要以%1s的格式进行输入,这样就避免了输入多个字符。 体会:在调试程序的过程中,我觉得自己要善于分析程序的问

5、题所在,尽量做到自己独立处理问题的能力。同时在调试程序的过程中,要有不厌其烦的精神,出现问题后不要感到失落,要相信自己一定能攻破难关。五 用户使用说明操作步骤:一、 开始此时要按下Y或y键才能进入系统,如果输入错误时,系统会有提示,并要求重新输入。二、输入信息进入此界面时,系统首先提示要输入教师的个数,输入后再输入教师的具体信息,此时的界面如下图:三、具体信息 进入此界面后,系统会提示用户需要按下哪些键才能执行相应的功能,如果输入错误时,系统会有提示,并要求重新输入,此时的界面如下:四、排序 在进入此界面之前,系统会提示用户想要用哪种方式对教师进行排序,如果选择y或Y时就会出现以下的界面(即以

6、总分的方式对教师进行排序),当排序完成后,系统会提示用户是否继续执行此功能,用户按系统要求按下指定的键后,系统就会出现相应的功能。五、查找在进入此界面之前,系统会提示用户想要用哪种方式对教师进行查找,如果选择y或Y时就会出现以下的界面(即以姓名的方式来查找教师的相关信息),当查找完成后,系统会提示用户是否继续执行此功能,用户按系统要求按下指定的键后,系统就会出现相应的功能。六、结束 这是结束系统的界面,按下系统指定的键后就可以进入此界面。六测试结果(1).输入n个教师的信息(n由用户输入):(2).输出n个教师的信息(n由用户输入): (3).根据教学效果综合评分排序:(4).根据职工号进行排

7、序:(5).根据姓名进行查找,而且如果当姓名输入错误时会有提示!(6).根据职工号进行查找,而且如果当职工号输入错误时会有提示!(7).如果在系统开始后,没有按指定的键输入数据时,系统就不会去实现相应的功能此时系统会有提示!并要求重新输入。七附录(1).主函数#include#include#includestruct teacherint num;char name30;char competent30;char sex4;float score3;float sum;extern void InPut(struct teacher *p,int n);extern void SumofSc

8、ores(struct teacher *p,int n);extern void OutPut(struct teacher *p,int n);extern void ReorderbyScore(struct teacher *p,int n);extern void ReorderbyNum(struct teacher *p,int n);extern char InputInformation(void);extern void SeacherbyName(struct teacher *p,char teacher,int n);extern void SeacherbyNum(

9、struct teacher *p,int teacher2,int n);extern void FoutPut(struct teacher *p,int n);int main()int flag,n;int teacher2;char c,selectnum,teacher10;struct teacher tea80;doflag=1; /*以下的一部分是系统开始的界面*/printf(nnnnn);printf(tt*n);printf(tt*);printf(tttttt*n);printf(tt*);printf(tttttt*n);printf(tt*);printf(ttt

10、ttt*n);printf(tt* welcome to the teachers educational systemt*n);printf(tt*);printf(tttttt*n);printf(tt*);printf(tttttt*n);printf(tt*);printf(tttttt*n);printf(tt*n);printf(tttplease input y or Y to continue.);doscanf(%1s,&c);if(c!=y&c!=Y) /*输入Y或y才能进入系统*/printf(You put error!Please input again!n);whi

11、le(c!=y&c!=Y);system(cls); /*清屏*/ printf(Please input the number of Teachers:n);scanf(%d,&n);printf(Please input %d teachers informationn,n);printf(NumtNametCompetent SextMath English Computern);InPut(tea,n); /*调用输入数据的函数,用来输入数据并保存在文件中*/SumofScores(tea,n); /*调用计算综合评分的函数,用来计算每个教师的综合评分*/system(cls); /*

12、清屏*/ printf(tt THE TEACHERS INFORMATION n);printf(*n);FoutPut(tea,n);/*调用输出的函数,用来读出文件的信息来把每个教师的信息都显示在屏幕上*/printf(*nn);selectnum=InputInformation(); /*用来提示用户,系统需要按哪些键才能实现相应的功能*/while(flag)switch(selectnum) case a:system(cls);/*清屏*/ doprintf(Do you want to order teachers information by scores?Yes,plea

13、se input y or Y.else order it by course.n); /*提示用户,想要用哪种方法对教师进行排序*/scanf(%1s,&c); if(c=y|c=Y)system(cls); /*清屏*/ printf(ttt ORDERED BY SUM n);printf(*n);ReorderbyScore(tea,n);/*调用用综合评分排序的函数,用来给教师排序*/OutPut(tea,n); /*调用输出的函数,用来把教师的信息显示出来*/printf(*nn);elsesystem(cls); /*清屏*/ printf(ttt ORDERED BY NUM

14、n);printf(*n);ReorderbyNum(tea,n);/* 调用用职工号来排序的函数,用来给教师排序*/OutPut(tea,n); /*调用输出的函数,用来把教师的信息显示出来*/printf(*nn);printf(Do you want to continue.Yes,please input y or Y.else,input n or N.n); /*提示用户,是否还要继续执行此功能*/scanf(%1s,&c); while(c=y|c=Y);selectnum=InputInformation(); /*调用此函数用来提示用户,系统需要按哪些键才能实现相应的功能*/

15、break;case b:system(cls); /*清屏*/ doprintf(Do you want to seacher teachers information by name?Yes,please input y or Y.else seacher it by course.n);/*提示用户,想要用哪种方法来查找教师的相关信息*/scanf(%1s,&c); if(c=y|c=Y)printf(Please input the name who you want to find:n);scanf(%s,teacher);SeacherbyName(tea,teacher,n);

16、/*调用此函数,通过用姓名的方式来查找相应的教师*/elseprintf(Please input the teachers num that you want to know:n);scanf(%d,&teacher2);SeacherbyNum(tea,teacher2,n); /*调用此函数,通过用职工号的方式来查找相应的教师*/printf(Do you want to continun?Yes,please input Y or y.No,please input N.n);/*提示用户,是否还要继续执行此功能*/scanf(%s,&c); printf(*nn);printf(*n

17、n);while(c=y|c=Y);selectnum=InputInformation(); /*调用此函数用来提示用户,系统需要按哪些键才能实现相应的功能*/break;case c:system(cls); /*清屏*/ flag=0; selectnum=c;break;case d:system(cls); /*清屏*/ /*以下的一部分是系统结束的界面*/printf(nnn);printf(t n);printf(t ttttttt n);printf(t t* Thanking for you useing my system! *t n);printf(t t *ttttt*

18、t n);printf(t t *tttt *t n);printf(t t *tttt *tt n);printf(t t *t GOOD BYE!t *t t n);printf(t tt *ttt *tt n);printf(t tt *tt *tt t n);printf(t ttt*t *ttt n);printf(t ttt *tttt n);printf(t tttt made by LiYan!t n);printf(t ttttttt n);printf(t n);flag=0;break;default:doprintf(You has input an invalid s

19、elect!Please input again!n);/*提示用户,输入错误,需要重新输入*/scanf(%1s,&selectnum); while(selectnum!=a&selectnum!=b&selectnum!=c&selectnum!=d); while(selectnum=c); return 0;(2).调用用来输入数据并写入文件的函数:#include#includestruct teacherint num;char name30;char competent30;char sex4;float score3;float sum;void InPut(struct t

20、eacher *p,int n)int i;FILE *fp;for(i=0;in;i+)scanf(%d%s%s%s%f%f%f,&pi.num,pi.name,petent,pi.sex,&pi.score0,&pi.score1,&pi.score2);if(fp=fopen(score.txt,w)=NULL)printf(Cants open file.);exit(0);for(i=0;in;i+)fprintf(fp,%d %s %s %s %.1f %.1f %.1f ,pi.num,pi.name,petent,pi.sex,pi.score0,pi.score1,pi.sc

21、ore2);fclose(fp);(3).调用用来输出数据的函数: #includestruct teacherint num;char name30;char competent30;char sex4;float score3;float sum;void OutPut(struct teacher *p,int n)int i;printf(NumtNametCompetenttSextMathtEnglishtComputertSumn);for(i=0;in;i+)printf(%dt%st%stt%st%.1ft%.1ft%.1ftt%.1fn,pi.num,pi.name,pet

22、ent,pi.sex,pi.score0,pi.score1,pi.score2,pi.sum); (4).调用用来计算教师综合评分的函数:struct teacherint num;char name30;char competent30;char sex4;float score3;float sum;void SumofScores(struct teacher *p,int n)int i;for(i=0;in;i+)pi.sum=pi.score0+pi.score1+pi.score2; (5).调用用教师的综合评分来排序的函数:struct teacherint num;char

23、 name30;char competent30;char sex4;float score3;float sum;void ReorderbyScore(struct teacher *p,int n)int i,j;struct teacher t;for(i=0;in-1;i+)for(j=0;jn-1-i;j+)if(pj.sumpj+1.sum)t=pj;pj=pj+1;pj+1=t; (6).调用用教师的职工号来排序的函数:struct teacherint num;char name30;char competent30;char sex4;float score3;float

24、sum;void ReorderbyNum(struct teacher *p,int n)int i,j;struct teacher t;for(i=0;in-1;i+)for(j=0;jpj+1.num)t=pj;pj=pj+1;pj+1=t; (7).调用用教师的姓名来查找相应信息的函数:struct teacherint num;char name30;char competent30;char sex4;float score3;float sum;void SeacherbyName(struct teacher *p,char teacher,int n)int i,flag=

25、1,t;for(i=0;in&flag;i+)if(strcmp(pi.name,teacher)=0)flag=0;t=i;if(!flag)printf(NumtNametCompetenttSextMathtEnglishtComputertSumn);printf(%dt%st%stt%st%.1ft%.1ft%.1ftt%.1fn,pt.num,pt.name,petent,pt.sex,pt.score0,pt.score1,pt.score2,pt.sum);elseprintf(You put error!my system cant find!n); (8).调用用教师的职工

26、号来查找相应信息的函数:struct teacherint num;char name30;char competent30;char sex4;float score3;float sum;void SeacherbyNum(struct teacher *p,int teacher2,int n)int i,flag=1,t;for(i=0;in&flag;i+)if(pi.num=teacher2)flag=0;t=i;if(!flag)printf(NumtNametCompetenttSextMathtEnglishtComputertSumn);printf(%dt%st%stt%

27、st%.1ft%.1ft%.1ftt%.1fn,pt.num,pt.name,petent,pt.sex,pt.score0,pt.score1,pt.score2,pt.sum);elseprintf(You put error!my system cant find!n); (9).调用用来提示用户,系统需要按哪些键才能实现相应功能的函数:#includestruct teacherint num;char name30;char competent30;char sex4;float score3;float sum;char InputInformation(void) char c;

28、printf(The teachers order by score or num!please input a to entern);printf(Seacher the teacher who you want!please input b to entern);printf(Back to the main table!please input c to entern);printf(Exit the system!please input d to enternn);printf(please input a task that you want to accomplish.n);sc

29、anf(%1s,&c);return c;(10).调用输出的函数,用来读出文件的信息来把每个教师的信息都显示在屏幕上:#include#includestruct teacherint num;char name30;char competent30;char sex4;float score3;float sum;void FoutPut(struct teacher *p,int n)int i;FILE *fp;if(fp=fopen(score.txt,r)=NULL)printf(Cants open file.);exit(0);for(i=0;in;i+)fscanf(fp,%d%s%s%s%f%f%f,&pi.num,pi.name,petent,pi.sex,&pi.score0,&pi.score1,&pi.score2);printf(NumtNametCompetenttSextMathtEnglishtComputertSumn);for(i=0;in;i+)printf(%dt%st%stt%st%.1ft%.1ft%.1ftt%.1fn,pi.num,pi.name,petent,pi.sex,pi.score0,pi.score1,pi.score2,pi.sum);printf(n);

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

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


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号