员工管理系统课程设计报告.doc_第1页
员工管理系统课程设计报告.doc_第2页
员工管理系统课程设计报告.doc_第3页
员工管理系统课程设计报告.doc_第4页
员工管理系统课程设计报告.doc_第5页
已阅读5页,还剩33页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

员工管理系统1. 设计目的随着目前公司规模的渐渐扩大,人事管理将成为一件不得不重视的问题。有些公司人员流动较大,而且人数动辄上百人,若采用传统的方式进行管理,不仅易出错更是一件令人头疼的事。随着计算机的诞生,在此领域产生众多的信息管理系统来管理信息,不仅信息处理方便,而且简单,强大。本系统正是其中的一项,针对人事信息管理,方便公司对员工的信息进行处理,极大减少了人事管理的工作量。另一方面,本系统中所涉及到对链表的操作是我们学习程序设计这门课的难点兼重点,通过设计本系统,不仅巩固了我们的C语言基础,以及程序设计能力,还锻炼了我们对程序设计的流程及大体上的把握。不仅如此,在设计过程中,我们的调试能力也得到增强。使我们对设计“大程序”有了经验。 2. 设计要求(1)系统以菜单方式工作。(2)输入数据模块,数据以文件保存。(3)输出数据模块,数据以文件方式读入。(4)基本的算法运用模块(至少包括添加、修改、删除、查找、排序、统计)。(5)系统其它功能实现。(6)员工信息包括:编号、姓名、部门、年龄、性别、工资等。3. 设计方案(1)确立方向,确立本系统的方向。(2)需求分析。分析当前市场的需求,即那些方面仍旧不完善,能用到计算机解决。以及是否使用了很大。(3)根据需求初步分析出系统的功能,画出示意图。(4)进行详细的功能分析,考虑各细节。(5)进入代码开发阶段,编写程序,进行调试直到成功。4. 设计内容4.1需求分析 随着目前公司规模的渐渐扩大,人事管理将成为一件不得不重视的问题。有些公司人员流动较大,而且人数动辄上百人,若采用传统的方式进行管理,不仅易出错更是一件令人头疼的事。随着计算机的诞生,在此领域产生众多的信息管理系统来管理信息,不仅信息处理方便,而且简单,强大。本系统正是其中的一项,针对人事信息管理,方便公司对员工的信息进行处理,极大减少了人事管理的工作量。4.2概要设计说明主菜单身份验证数据备份添加记录查看记录查询记录修改记录排序记录插入记录删除记录保存记录统计数据命令模式用户管理按ID按姓名按ID按姓名按ID按姓名4.3详细设计说明(1) login()函数:身份验证模块,采用新的结构体来保存用户信息,包括用户名及密码。并将其保存在文件中。程序载入时读入用户信息,与输入信息比较,相同则通过否则要求重新输入。(2) add()函数:创建或添加记录,采用链表方式,判断是否空链表,是则创建,否则往链表尾采用动态声请空间添加记录。(3) printall()函数:输出记录模块,首先判断链表是否为空,否则采用while循环输出直到下条记录为空。(4) delbyid()函数:按id方式删除记录,首先采用while循环定位到符合条件的那条记录,然后将前条记录的指针指向下条记录。(5) delbyname()函数:按姓名方式删除记录,与上相似。(6) insert()函数:插入记录模块,首先动态开辟内存空间,赋予相应的记录值,在用while循环定位到要插入位置,进行插入。(7) findbyid()函数:按ID方式查找记录,首先要求输入相应id,采用while循环判断符合条件的记录,若符合则输出,直到链表尾。(8) findbyname()函数:按姓名方式查找记录,实现与上相似。(9) modify()函数:修改记录模块,首先输入要修改记录的内容,采用while循环定位到相应记录,并将相应修改后的内容赋予该记录。(10) sortbyid()函数:按ID排序功能模块,首先判断链表是否为空,否则采用冒泡排序,即采用两个for循环,在第二个for循环中判断大小,决定是否交换。(11) sortbyname()函数:按姓名排序功能模块,与上相似。(12)save()函数:保存记录模块,首先判断链表是否为空,否则采用while循环将每条记录写入到文件,直至链表尾。(13)load()函数:读入数据模块,采用while循环判断是否文件尾,读入数据后调用add()函数添加或创建链表。(14)execmd()函数:命令行判断模块,根据输入的命令,使用ifelse if判断是否符合条件,例如添加记录,符合后在用scanf函数继续得到数据,调用add函数进行添加。(15)help()函数:根据输入的命令判断为哪个命令,再输出该命令帮助。 4.4 运行界面(1)身份验证功能:(2)主界面:(3)添加模块:(4)查看所有记录模块:(5)查询记录模块:(6)修改记录模块:(7)排序模块:(8)插入记录模块:(9)删除模块:(10)统计模块:(11)命令行模式:(12)用户信息管理模块:4.5系统使用说明(1)运行程序后,输入用户名密码进入系统,若数据修改超过10则提示备份。(2)进入主界面后,按提示输入要操作的数字,输入选择相应功能。(3)添加功能:进入添加界面后输入相应数据进行添加,要退出输入q或Q。(4)查看功能:输入2则可查看所有记录。(5)查询功能:进入查询界面后,选择1按ID查询,输入相应ID即可。按姓名查询请选2.(6)修改功能:进入修改功能后,输入要修过的ID,在输入修改后的数据即可。(7)排序功能:进入排序界面后,选1按ID排序,选2按姓名排序,选3返回。(8)插入功能:进入插入界面后,输入要插入的数据即可。(9)统计功能:选择此功能后,系统将显示统计后的结果。(10)保存和导入数据库:选择保存后系统将保存当前数据,选择导入数据库,系统将要求输入数据库路径,输入数据库路径即可。(11)命令行模式:进入命令行后在命令提示符后输入相应命令即可,可以输入help all命令查看所以命令及其使用方法,也可在help命令后加相应命令,即可得到该命令的帮助。(12)修改用户信息:进入界面后输入旧密码,在输入新用户名和新密码及重复密码即可修改用户名和密码。(13)退出:选择14后退出,输入Q或q退出。5. 总结通过本系统的设计我学会了软件的开发的许多方法,也巩固了许多以前的知识点,与难点。例如:链表一直是个难点,通过本次设计,我更深入掌握了它的用法。同时也复习了许多语法知识点,以前不太注意的地方,现在得到巩固。在设计过程中遇到许多困难,例如链表的调试,以及边界问题,这些问题在编译器语法检查时都没问题而在运行后往往造成程序死循环或退出。另外,本系统的开发也锻炼了我独立设计系统的能力,因为该系统功能较全面,设计方面很广,所以设计过程中我不仅要考虑语法知识点,而且还得考虑算法,使我真正明白“程序=算法+数据结构”这个公式。我也费了许多心思为系统添加与众不同的功能,例如进度条,数据库备份,命令行模式。从中知道程序设计不仅是模仿,还得创新。另外还是确认了“纸上得来终觉浅,绝知此事要躬行”这句话的含义,许多看似简单,实践时往往是绊脚石。本系统还有许多bug仍未发现以及功能方面不成熟,投入实际使用可能会带来不方便,例如有些功能对用户输入过于信任,易造成溢出从而程序退出数据丢失。在以后我还得对其改进。参考文献1 谭浩强.C程序设计(第三版). 清华大学出版社,2005 附录主要代码:#include #include #include #include /struct employerchar id8;char name10;char sex5;char job20;char birthday10; float pay;struct employer *next;struct user char username10; char pwd16; ;/void about();void login();void printmenu();void process();void choose(int cmd);void printall(struct employer *head);struct employer *delbyid(struct employer *head,char id8);struct employer *delbyname(struct employer *head,char name10);struct employer *insert(struct employer *head,struct employer temp);struct employer *add(struct employer temp);void findbyid(struct employer *head,char id8);void findbyname(struct employer *head,char name10);void modify(struct employer *head,char id8,struct employer temp);void sortbyid(struct employer *head);void sortbyname(struct employer *head);void save(struct employer *head);void format();void quit();void madd();void mfind();void msort();void mdel();void mmodify();void minsert();void mload();struct employer *load(char filepath30);void sum();char execmd();void mexecmd();void modifyuserinfo();void help(char temp10);void exchange(struct employer *p1, struct employer *p2);/int n=0;char dbpath=employer.db;struct employer *head=NULL;int savedata=1;/int main(int argc, char *argv) about(); login(); head=load(employer.db); printmenu(); return 0;/void about() system(cls); printf(nnn); printf(ttt* * * * * 员工管理系统 * * * * * *ttn); printf(ttt* *ttn); printf(ttt* 本系统特色: *ttn); printf(ttt* 1.支持数据备份。 *ttn); printf(ttt* 2.支持身份验证。 *ttn); printf(ttt* 3.支持命令模式。 *ttn); printf(ttt* 4.支持用户信息修改。 *ttn); printf(ttt* 5.支持数据库导入。 *ttn); printf(ttt* *ttn); printf(ttt* 作者:雷世明 计科1号 *ttn); printf(ttt* 声明: *ttn); printf(ttt* 本系统为课程设计 *ttn); printf(ttt* *ttn); printf(ttt* * * * * * * * * * * * * * * * *ttn); system(pause); process(); /void login() FILE *fp; char username10;char pwd16; struct user temp; system(cls); printf(nn); fp=fopen(user.db,r); if(fp=NULL) printf(#对不起,user.db打开错误!n); system(pause); exit(0); else fread(&temp,sizeof(struct user),1,fp); fclose(fp); printf(*n);line1: printf(#请输入您的用户名:); scanf(%s,username); printf(*n); printf(#请输入您的密码:); scanf(%s,pwd); if(strcmp(username,temp.username)|(strcmp(pwd,temp.pwd) printf(*n); printf(#对不起,用户名或密码错误!n); goto line1; /void printmenu() int cmd; while(1) system(cls); printf(nnn); ; printf(tt* * * * * *员 工 管 理 系 统* * * * * * *ttn); printf(tt* *ttn); printf(tt* 请选择: *ttn); printf(tt* 1.添加 员 工 记 录 *ttn); printf(tt* 2.查看 所 有 记 录 *ttn); printf(tt* 3.查询 员 工 记 录 *ttn); printf(tt* 4.修改 员 工 记 录 *ttn); printf(tt* 5.排序 员 工 记 录 *ttn); printf(tt* 6.插入 员 工 记 录 *ttn); printf(tt* 7.删除 员 工 记 录 *ttn); printf(tt* 8.保存 员 工 记 录 *ttn); printf(tt* 9.统计 月 薪 水 支 出 *ttn); printf(tt* 10.导入 数 据 库 *ttn); printf(tt* 11.命 令 模 式 *ttn); printf(tt* 12.修 改 用 户 信 息 *ttn); printf(tt* 13.关 于 *ttn); printf(tt* 14.退 出 系 统 *ttn); printf(tt* * * * * * * * * * * * * * * * * * * * * * ttn); printf(ntt#请输入选择(1-14):); scanf(%d,&cmd); choose(cmd); system(pause); / void process() char temp=; char tempout100=; int i; for(i=1;iid,p1-name,p1-job,p1-sex,p1-pay,p1-birthday);p1=p1-next;printf(*n);printf(#总计共%d条记录.n,n);system(pause);/struct employer *delbyid(struct employer *head,char id8)struct employer *p1,*p2;if(head=NULL)printf(n#对不起,链表为空.n);system(pause);goto end;p1=head;while(strcmp(id,p1-id)!=0 & p1-next!=NULL)p2=p1;p1=p1-next;if(strcmp(id,p1-id)=0)if(p1=head)head=p1-next;elsep2-next=p1-next;printf(#已经删除了id 为%s的记录.n,id);n=n-1;savedata=0;system(pause);elseprintf(#没有找到相关的记录.n); system(pause);end:return(head);/struct employer *delbyname(struct employer *head,char name10)struct employer *p1,*p2;if(head=NULL)printf(n#对不起,链表为空.n);system(pause);goto end;p1=head;while(strcmp(name,p1-name)!=0 & p1-next!=NULL)p2=p1;p1=p1-next;if(strcmp(name,p1-name)=0)if(p1=head)head=p1-next;elsep2-next=p1-next;printf(#已经删除了id 为%s的记录.n,p1-id);n=n-1;savedata=0;system(pause);elseprintf(#没有找到相关的记录.n);system(pause);end:return(head);/struct employer *insert(struct employer *head,struct employer temp)struct employer *p0,*p1,*p2;p1=head;p0=(struct employer *)malloc(sizeof(struct employer);strcpy(p0-id,temp.id);strcpy(p0-name,);strcpy(p0-job,temp.job);strcpy(p0-birthday,temp.birthday);p0-pay=temp.pay;strcpy(p0-sex,temp.sex);if(head=NULL)head=add(temp);elsewhile(strcmp(p0-id,p1-id)=0) & (p1-next!=NULL)p2=p1;p1=p1-next;p2-next=p0;p0-next=p1;n=n+1;savedata=0;return(head);/struct employer *add(struct employer temp)struct employer *p1,*p2;if(head=NULL)p1=(struct employer *)malloc(sizeof(struct employer);temp.next=NULL;strcpy(p1-id,temp.id);strcpy(p1-name,);strcpy(p1-job,temp.job);strcpy(p1-birthday,temp.birthday);p1-pay=temp.pay;strcpy(p1-sex,temp.sex);p1-next=temp.next;head=p1;n+;else /g1:p1=head;while(p1-next!=NULL)p1=p1-next;p2=(struct employer *)malloc(sizeof(struct employer);temp.next=NULL;strcpy(p2-id,temp.id);strcpy(p2-name,);strcpy(p2-job,temp.job);strcpy(p2-birthday,temp.birthday);p2-pay=temp.pay;strcpy(p2-sex,temp.sex);p2-next=temp.next; p1-next=p2;n+;savedata=0;/printf(是否还回上一级,y/n?); /scanf(%s,judge); /if(judge=y) goto g1; return(head);/void findbyid(struct employer *head,char id8)struct employer *p1;printf(n*查询结果*n);if(head=NULL)printf(#对不起,您的数据库里没有任何记录.n);system(pause);return;p1=head;printf(IDt姓名t职位t性别t月薪t出生日期n);while(p1!=NULL)if(strcmp(id,p1-id)=0)printf(%st%st%st%st%ft%sn,p1-id,p1-name,p1-job,p1-sex,p1-pay,p1-birthday);p1=p1-next;printf(n*n);system(pause);/void findbyname(struct employer *head,char name10)struct employer *p1;printf(n*查询结果*n);if(head=NULL)printf(#对不起,您的数据库里没有任何记录.n);system(pause);return;p1=head;printf(IDt姓名t职位t性别t月薪t出生日期n);while(p1!=NULL)if(strcmp(name,p1-name)=0)printf(%st%st%st%st%ft%sn,p1-id,p1-name,p1-job,p1-sex,p1-pay,p1-birthday);p1=p1-next;printf(n*n);system(pause);/void modify(struct employer *head,char id8,struct employer temp)struct employer *p1;if(head=NULL)printf(#对不起,您的数据库里没有任何记录.n);system(pause);return;p1=head;while(p1!=NULL)if(strcmp(id,p1-id)=0)temp.next=p1-next;strcpy(p1-id,temp.id); strcpy(p1-name,); strcpy(p1-job,temp.job); strcpy(p1-birthday,temp.birthday); p1-pay=temp.pay; strcpy(p1-sex,temp.sex); p1-next=temp.next;p1=p1-next;savedata=0;/void sortbyid(struct employer *head)employer *small=NULL;employer *temp =NULL;employer *newfirst=NULL;employer *newpre=NULL;while(head-next!=NULL)small=head-next;temp=head-next;while(temp!=NULL)if(strcmp(temp-id,small-id)=-1)small=temp;temp=temp-next;temp=head;while(temp-next!=small)temp=temp-next;temp-next=small-next;if(newfirst=NULL)newfirst=small;newfirst-next=NULL;newpre=newfirst;elsenewpre-next=small;small-next=NULL;newpre=small;head-next=newfirst;temp=NULL;newfirst=NULL;newpre=NULL;return;/void sortbyname(struct employer *head)employer *small=NULL;employer *temp =NULL;employer *newfirst=NULL;employer *newpre=NULL;while(head-next!=NULL)small=head-next;temp=head-next;while(temp!=NULL)if(strcmp(temp-name,small-name)=-1)small=temp;temp=temp-next;temp=head;while(temp-next!=small)temp=temp-next;temp-next=small-next;if(newfirst=NULL)newfirst=small;newfirst-next=NULL;newpre=newfirst;elsenewpre-next=small;small-next=NULL;newpre=small;head-next=newfirst;temp=NULL;newfirst=NULL;newpre=NULL;return;/void save(struct employer *head)FILE *fp;struct employer *p1;if(head=NULL)printf(n#您没有需要保存的记录,无须保存.n);system(pause);return;fp=fopen(dbpath,w+);if(fp=NULL)printf(n#打开%s失败.n,dbpath);system(pause);return;p1=head;while(p1!=NULL)fwrite(p1,sizeof(struct employer),1,fp);p1=p1-next;fclose(fp);printf(n#保存成功!n);system(pause);/void format()system(cls);printf(nn);printf(*n);/void choose(int cmd)switch(cmd) case 1: format(); madd(); break; case 2: format(); printall(head); break; case 3: format(); mfind(); break; case 4: format(); mmodify(); break; case 5: format(); msort(); break; case 6: format(); minsert(); break; case 7: format(); mdel(); break; case 8: format(); save(head); break; case 9: format(); sum(); break; case 10: format(); mload(); break; case 11: format(); mexecmd(); break; case 12: format(); modifyuserinfo(); break; case 13: system(cls); about(); break; case 14: format(); quit(); break; default: format(); printf(#不可识别的命令.n); system(pause); /void quit()char c;if(savedata=0) printf(#数据未保存,是否保存?(Y/N):); getchar(); scanf(%c,&c); if(c=Y | c=y)save(head);exit(0);elseprintf(#是否退出?(Y/N):); getchar(); scanf(%c,&c); if(c=Y | c=y)exit(0);/void madd()struct employer temp;char c;do printf(#请输入员工ID:); scanf(%s,temp.id); printf(#请输入员工姓名:); scanf(%s,); printf(#请输入员工职位:); scanf(%s,temp.job); printf(#请输入员工性别:); scanf(%s,temp.sex); printf(#请输入员工月薪:); scanf(%f,&temp.pay); printf(#请输入员工出生日期:); scanf(%s,temp.birthday); head=add(temp); printf(#按任意键继续添加,Q退出:n); c=get

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论