1、教师基本信息管理系统数据结构课程设计数据结构课程设计(论文)教师基本信息管理系统 院(系)名称 专业班级 学号 学生姓名 指导教师起 止 时 间: 2014.12.292015.1.9课程设计(论文)任务及评语院(系):电子与信息工程学院 教研室:软件工程学 号学生姓名专业班级课程设计(论文)题目教师基本信息管理系统课程设计(论文)任务任务要求:教师基本信息管理系统有以下几个功能:输入和输出教师信息;信息查询排序;删除和修改教师信息;查新教师信息。输入信息即为在初始时所输入的教师信息,即个人姓名、性别、出生年月、学历、家庭住址和电话号码,还有在职时的教师号、工作时间、和职务,以方便在输出时提供
2、了基础。还有例如进行教师评估时所要进行的信息查询。离职或退休的教师则进行删除信息。若进行查看时如有错误信息,及时能进行修改。所有的都为了在查询信息时更方便。技术要求:1、数据的逻辑结构采用线性结构,物理结构采用链式存储结构。2、软件能正常运行,界面清晰,操作要简单。3、系统要有主界面设计,调用各个功能项。4、采用Viscal C+编写代码,可读性强。5、数据类型用typedef 定义。指导教师评语及成绩平时成绩: 答辩成绩: 论文成绩: 总成绩: 指导教师签字: 年 月 日注:平时成绩占20%,答辩成绩占40%,论文成绩占40%。摘 要教师基本信息管理系统是新时期的一个计算机语言的一个编译系统
3、。通过系统分析、设计,调试程序,进一步掌握方法和应用。这样的系统在实际的应用中有很大的帮助,它把教师的基本信息输入到电脑中,使电脑存留教师信息,而后进行修改和删除及查找工作。得到信息的完整性和严密性。它可以在校园内规模的使用,达到一种严密、正确、方便查看及进行修改。达到人满意的效果,在新旧老教师之间也有一个的记录,课程分科明显,在查询时是极方便的。在数据结构方向上,它也是思维的锻炼,更加灵活的运用计算机语言。使人明白懂得这样的信息,更加了解。系统的开发主要包括使用C+程序,建立成数据一致性和完整性强、数据安全性好的数据,具有应用程序功能完备,易使用等特点。关键词: 第1章 绪论1.1系统的开发
4、背景伴随着信息技术和网络技术的发展,人类已进入了知识的时代。教师基本信息管理系统是新时期的以计算机语言为基础的系统。伴随着知识在生活中重要性的提升,校园中教师信息更是需要有一个高级的系统去管理。本系统的开发,是由于在现今的高校中需要这样的系统去管理教师的基本的信息,这样既可以方便查找入职与离职的教师信息,可以完善教师的全备的信息,相对比以往的手动、手写的资料更易存放与查找和保存,越来越高科技的时代,更需要人来采用这样的一种手段去适应这个时代。 通过对教师信息的输入和输出,完善教师信息,删除离岗教师信息是一个非常好的前景。1.2开发工具及语言本系统使用Viscal C+语言开发,主界面清晰显示所
5、有功能项,使用简单。各个功能项均定义一个函数来实现,在主函数中调用各个子函数实现不同的功能。 第2章 概要设计2.1模块划分题目应实现的具体功能;a.教师基本信息包括:在职教师号、姓名(必填)、教师性别(必填)、教师出生年月、教师入职时间(必填)、教师岗位(必填)、教师住址及联系方式(必填)。b.系统能实现的操作和功能如下:1. 输入教师基本信息:首先要把新赠的教师的信息输入到电脑中,使系统存留教师的信息。2. 删除教师信息:从教师管理文件中删除一名教师对象,可能为退休或离岗。3. 查询信息:从教师管理文件中查询符合某些条件的教师,使查询目的成功。4. 修改信息:检索某个教师对象,对其某些属性
6、进行修改,例如:姓名、性别等。5. 排序:按某种需要对教师对象文件进行排序。得到目的。2.2 数据结构的选择系统数据的逻辑结构采用线性结构,物理结构采用链式存储结构。存储结构定义如下:static struct staff int num; char name20; char sex; long byear;/birth year 出生年月 long iyear;/imploy year 工作年月 char education20; char duty20; char address20;第3章 系统详细设计与编码3.1完整的源程序#include#include#include#includ
7、e #define I 100static char tempstr20; /*用于临时存储输入信息的数组*/static struct staff int num; char name20; char sex; long byear;/birth year 出生年月 long iyear;/imploy year 工作年月 char education20; char duty20; char address20; char phone20; struct staff *next;*head=NULL,*thisn,*newn,staI=0,temp; /*temp用于交换的中间量*/voi
8、d cin(void); /*输入信息*/int identify(int num); /*对教师号是否重复进行验证*/void cout(void); /*输出信息*/void sort(void); /*查询排序*/void del(void); /*删除教师信息*/int record(void); /*将文件中的数据录入结构体数组中*/void iyear(int j); /*按工作年月排序*/void education(int j); /*按学历排序*/void modify(void); /*修改教师信息*/ void descending(void); /*学历降序输出*/ v
9、oid ascending(void); /*学历升序输出*/void printmsg(int i); /*输出信息*/void seek(void); /*查询教师信息*/ int main(void) int flag=1; while(flag) system(cls); /*清屏*/ printf( 欢迎登陆教师信息管理系统!n); printf( 【1】 输入教师信息 【2】 输出教师信息n); printf( 【3】 信息查询排序 【4】 删除教师信息n); printf( 【5】 修改教师信息 【6】 查询教师信息n); printf(请输入以上数字,选择相应的功能: ); s
10、witch (getchar() case 1:cin();break; /*调用输入信息的函数*/ case 2:cout();break; /*调用输出信息的函数*/ case 3:sort();break; /*调用排序的函数*/ case 4:del();break; /*调用删除教师信息函数*/ case 5:modify();break; /*调用修改教师信息的函数*/ case 6:seek();break; /*查询教师信息*/ default:flag=0;break; /*跳出循环体,结束程序*/ return 0;void cin(void) /*输入信息的函数*/ FI
11、LE *fp; int receive; /*接收返回值*/ if(fp=fopen(information.txt,a+)=NULL) /*为读写打开一个文本文件*/ printf(文件打开错误n); exit(1); /*关闭所有文件,终止正在执行的程序,待用户检查出错误,修改后再运行*/ newn=(struct staff *)malloc(sizeof(struct staff); if(head=NULL) /*连接链表*/ head=newn; thisn=newn; thisn-next=NULL; else thisn=head; while(thisn-next!=NULL
12、) thisn=thisn-next; thisn-next=newn; thisn=newn; getchar(); /*接收缓冲区中选择菜单时多余的回车*/ fputc(n,fp); /*每次记录信息前先换行*/ printf(请输入教师号:); gets(tempstr);thisn-num=atoi(tempstr); /*atoi()将字符串转换成整型数*/ receive=identify(thisn-num); while(receive) printf(请输入教师号:); gets(tempstr);thisn-num=atoi(tempstr); receive=identi
13、fy(thisn-num); fputs(tempstr,fp); fputs( ,fp); /*信息排版的需要*/ printf(请输入姓名:); gets(thisn-name); fputs(thisn-name,fp); fputs( ,fp); printf(请输入性别(填F或M):); thisn-sex=getchar();getchar(); fputc(thisn-sex,fp); fputs( ,fp); printf(请输入出生年月(如199001):); gets(tempstr);thisn-byear=atoi(tempstr); fputs(tempstr,fp)
14、; fputs( ,fp); printf(请输入工作年月(如199001):); gets(tempstr);thisn-iyear=atoi(tempstr); fputs(tempstr,fp); fputs( ,fp); printf(请输入学历(博士、硕士、本科、其他):); gets(thisn-education); fputs(thisn-education,fp); fputs( ,fp); printf(请输入岗位:); gets(thisn-duty); fputs(thisn-duty,fp); fputs( ,fp); printf(请输入地址:); gets(thi
15、sn-address); fputs(thisn-address,fp); fputs( ,fp); printf(请输入电话号码:); gets(thisn-phone); fputs(thisn-phone,fp); thisn-next=NULL; fclose(fp); system(cls); /*清屏*/int identify(int num) /*对教师号是否重复进行验证*/ FILE *fp; int i; if(fp=fopen(information.txt,r)=NULL) printf(文件打开错误); exit(1); for(i=0;iI;i+) /*将文件中的信
16、息按行写入结构体数组中 */ fscanf(fp,%d %s %c %ld %ld %s %s %s %sn,&stai.num,&stai.name,&stai.sex,&stai.byear, &stai.iyear,&stai.education,&stai.duty,&stai.address,&stai.phone); if(stai.num=num) system(cls); printf(账号已存在 【1】重新输入 【2】退出系统n); printf(请输入以上数字,选择相应的功能: ); switch(getchar() case 1:getchar();return(1);
17、/*输入不成功,返回值作为循环条件*/ case 2:exit(1); /*退出系统*/ if(stai.num=0) /*动态限制循环输出的次数*/ break; fclose(fp); return (0); /*输入成功,返回值作为循环条件*/void cout(void) /*输出信息*/ FILE *fp; int s,i,j; system(cls); if(fp=fopen(information.txt,r)=NULL) printf(文件打开错误); exit(1); for(i=0;iI;i+) /*将文件中的信息按行写入结构体数组中并输出 */ fscanf(fp,%d
18、%s %c %ld %ld %s %s %s %sn,&stai.num,&stai.name,&stai.sex,&stai.byear, &stai.iyear,&stai.education,&stai.duty,&stai.address,&stai.phone); if(stai.num=0) /*动态限制循环输出的次数*/ break;s=record(); setlocale (LC_COLLATE, ); for (j=0;js-1;j+) for(i=0;i0) temp=stai; stai=stai+1; stai+1=temp; printf(教师号 姓名 性别 出生年
19、月 工作年月 学历 岗位 地址 电话n);printf(-n); for(i=0;is;i+) printmsg(i); fclose(fp); getchar(); /*接收回车*/ printf(nnnnn回到主界面请按r 退出系统请按其他键n); switch (getchar() case r:getchar();system(cls);break; /*getchar()接收回车*/ default:exit(0); void sort(void) /*查询排序*/ int j; getchar(); /*接收回车*/ j=record(); printf( 【1】 按工作年月排序
20、【2】按学历排序n); printf(请输入以上数字,选择相应的功能: ); switch (getchar() case 1:iyear(j);break; case 2:education(j);break; getchar(); /*接收回车*/ getchar(); /*接收回车*/ system(cls); printf( 【1】 回到主界面 【2】退出系统n); printf(请输入以上数字,选择相应的功能: ); switch(getchar() case 1:getchar();system(cls);break; default:exit(1); void iyear(int
21、 j) /*按工作年月排序*/ int i,k; /*i,k用于循环体中以及用于结构体下标*/ system(cls); for(k=0;kj-1;k+) for(i=0;i=j-k-1;i+) if(stai.iyearstai+1.iyear) temp=stai; stai=stai+1; stai+1=temp; printf(教师号 姓名 性别 出生年月 工作年月 学历 岗位 地址 电话n);printf(-n); for(i=0;i=j-1;i+)printf(%-5d %-10s %-4c %-4ld %-4ld %-6s %-6s %-20s %-sn,stai.num,sta
22、i.name,stai.sex,stai.byear, stai.iyear,stai.education,stai.duty,stai.address,stai.phone); printf( 【1】返回上一级 【2】退出系统n); printf(请输入以上数字,选择相应的功能: ); switch (getchar() case 1:system(cls);break; case 2:exit(1);break; void education(int j) /*按学历排序*/ FILE *fp; int i; if(fp=fopen(information.txt,r)=NULL) pri
23、ntf(文件打开错误); exit(1); for(i=0;iI;i+) /*将文件中的信息按行写入结构体数组中 */ if(stai.num=0) /*动态限制循环输出的次数*/ break; fscanf(fp,%d %s %c %ld %ld %s %s %s %sn,&stai.num,&stai.name,&stai.sex,&stai.byear, &stai.iyear,&stai.education,&stai.duty,&stai.address,&stai.phone); fclose(fp); getchar(); printf( 【1】学历降序排列 【2】学历升序排列n
24、); printf(请输入以上数字,选择相应的功能: ); switch(getchar() case 1:descending();break; case 2:ascending();break; printf(nn按任意键返回上一级);void del(void) /*删除教师信息*/ FILE *fp; int num,i,j,k; /*num用于输入要删除的教师号, i用于循环体以及数组下标,j记录教师人数*/ printf(请输入要删除的教师号:); scanf(%d,&num); getchar(); /*接收回车*/ system(cls); if(fp=fopen(inform
25、ation.txt,r)=NULL) printf(文件打开错误); exit(1); for(i=0;iI;i+) /*将文件中的信息按行写入结构体数组中并输出 */ fscanf(fp,%d %s %c %ld %ld %s %s %s %sn,&stai.num,&stai.name,&stai.sex,&stai.byear, &stai.iyear,&stai.education,&stai.duty,&stai.address,&stai.phone); if(stai.num=0) break; if(stai.num=num) j=i; fclose(fp); if(fp=fo
26、pen(information.txt,w)=NULL) /*重新向文件输入所有信息*/ printf(文件打开错误); exit(1); for(k=j;krecord();k+) stak=stak+1; for(i=0;irecord();i+) sprintf(tempstr,%d,stai.num); /*将整型数转化成字符串*/ fputs(tempstr,fp); fputs( ,fp); fputs(stai.name,fp); fputs( ,fp); fputc(stai.sex,fp); fputs( ,fp); sprintf(tempstr,%ld,stai.byea
27、r); fputs(tempstr,fp); fputs( ,fp); sprintf(tempstr,%ld,stai.iyear); fputs(tempstr,fp); fputs( ,fp); fputs(stai.education,fp); fputs( ,fp); fputs(stai.duty,fp); fputs( ,fp); fputs(stai.address,fp); fputs( ,fp); fputs(stai.phone,fp); fputc(n,fp); fclose(fp); int record(void) /*将文件中的数据录入结构体数组中*/ FILE *fp; int i,j; /*j用于记录教师的人数*/ system(cls
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1