C大作业---职员信息管理系统.doc

上传人:scccc 文档编号:11431674 上传时间:2021-08-04 格式:DOC 页数:30 大小:233KB
返回 下载 相关 举报
C大作业---职员信息管理系统.doc_第1页
第1页 / 共30页
C大作业---职员信息管理系统.doc_第2页
第2页 / 共30页
C大作业---职员信息管理系统.doc_第3页
第3页 / 共30页
C大作业---职员信息管理系统.doc_第4页
第4页 / 共30页
C大作业---职员信息管理系统.doc_第5页
第5页 / 共30页
点击查看更多>>
资源描述

《C大作业---职员信息管理系统.doc》由会员分享,可在线阅读,更多相关《C大作业---职员信息管理系统.doc(30页珍藏版)》请在三一文库上搜索。

1、(C+C+项目报告文档)项目报告文档) C+C+程序设计程序设计 职员信息管理系统 VersionVersion C+C+ 6.06.0 生命科学与技术学院 生物医学工程专业 1004 班 指导教师:彭娅婷 日期:2011 年 07 月 03 日 开发团队 人员姓名 学号 任务成 绩 刘奔 U201012635 浏览信息模块 Word 文档 3,4 部分 张博 U201012636 信息录入模块, 添加信息模块 李扬 U201012637 信息排序 Word 文档 2(2,3,4,5) 张亚伦 U201012638 修改信息模块, 显示所有信息模块 杨龙 U201012639 删除信息模块 W

2、ord 文档 5,6 部分 齐中阳 U201012640 查询信息模块 main 函数的完成 胡宇 U201012641 保存文档模块 Word 文档 1,2(1)部分 目目 录录 1 项目(职员信息管理系统)需求分析.(1) (1)项目目标 (2)系统主要功能概述 (3)可行性分析 (4)项目运行环境 2 项目(职员信息管理系统)设计.(2) (1)概要设计 (2)详细设计 1) UML 图(类的结构和层次) 2)字段说明 (3)项目命名约定 (4)项目分工表 (5)项目进度表 3 项目(职员信息管理系统)功能介绍.(4) 4 项目(职员信息管理系统)功能测试.(5) 5 项目使用说明.(6

3、) 6 项目(系统)总结.(6) 附录 1 程序源代码.(7) 1 项目(职员信息管理系统)需求分析项目(职员信息管理系统)需求分析 1.1 项目目标 开发一职员信息管理系统,实现职员信息的录入,修改,查询,删除,保存 等功能。 1.2 系统主要功能概述 1.添加信息模块:初始化成员信息,包括职工号,姓名,性别,年龄,学 历,工资,住址,电话,给成员排序; 2.删除信息模块:删除某位员工信息数据; 3修改信息模块:依据职工的序号修改某位员工的信息; 4.信息查询模块:依据职员的序号查询某位职员的信息; 5.信息浏览模块:浏览当前所有职员信息; 6:信息排序模块:依据职工号,姓名,薪酬为职工排序

4、; 7:保存信息模块:将所录信息存入文档。 1.3 可行性分析 1. 1.系统可行性: 1:硬件支持:电脑(笔记本电脑,台式电脑)可以运行程序; 2:软件支持:Windows,VC+6.0 作为程序运行平台 2. 2.技术可行性: 依据本学期学习 C+知识,运用面向对象设计,团队成员协作完成。 3. 3.使用可行性 采用简单的 GUI 界面,用户经过短期培训即可方便使用系统。 1.4 项目运行环境 CPU 奔腾 1.4G 或以上 内存512M 或以上 硬盘80GB 或以上 服务器端 OS Windows 2000/NT/Server 客户端 OS Windows 2000/XP 网络配置局域网

5、 2 项目(职员信息管理系统)设计项目(职员信息管理系统)设计 2.1 概要设计: 建立 Employee 类,List 类,依据要求设计一个主函数,构 造函数,析构函数,以及 10 个功能函数,分别为: (1)InfoInput; /实现信息录入(有重载) (2)InfoScan; /用于浏览信息 (3)InfoQuery; /查询信息 (4)InfoSort; /信息排序 (5)InfoSwap (6)InfoDelete; /删除信息 (7)InfoModify; /修改信息 (8)InfoAdd; /添加信息 (9)showall;/显示所有信息 (10)SaveFile();/保存文

6、档 2.2 详细设计 UML 图 Employee 私有成员变量: num;name;sex; age;edu;salary; address;tele; ordernum; List 私有成员变量 num; employee *phead; 公有成员函数 employee(); Show(); Show1. List 公有成员函数 List() phead=new employee; num=0; void InfoInput(char*n,char*name,char*sex,int age,char*edu,float sal,char*addres,char*tele ); /信息录入

7、 void InfoInput(); /信息录入函数重载 void InfoScan(); /浏览信息 void InfoQuery(); /查询信息 void InfoSort(); /信息排序 void InfoSwap(employee *p,employee *q); void InfoDelete(); /删除信息 void InfoModify(); /修改信息 void InfoAdd(); /添加信息 void showall(); /显示所有信息 void SaveFile();/保存为文件 List(); /析构函数 2.3 项目命名约定 类名:大写字母开头 如:Emplo

8、yee,List 类属性:采用匈牙利命名法(即第一个字母小写并表明数据类型)如: void, char,int,float, 类方法:每个单词均为大写字母开头 如:InfoInput ();InfoScan() ; InfoQuery() ;InfoSort();InfoSwap() ;InfoDelete(); InfoModify();InfoAdd();showall(); SaveFile(); 变量:采用匈牙利命名法(即第一个字母小写并表明数据类型) 如: char*num;char*name;char*sex;int age;char*edu;float salary;char*a

9、ddres; char*tele;int ordernum; int num; 2.4 项目分工表 姓名分配任务/完成的功能模块备 注 刘奔浏览信息模块 Word 文档 3,4 部分 张博信息录入模块, 添加信息模块 李扬信息排序 Word 文档 2(2,3,4,5) 张亚伦修改信息模块, 显示所有信息模块 杨龙删除信息模块 Word 文档 5,6 部分 齐中阳查询信息模块 main 函数的完成 胡宇保存文档模块 Word 文档 1,2(1)部分 2.5 项目进度表 第 18 周项目讨论以及做项目需求分析 第 18 周项目概要设计,确定分工 第 19 周项目详细设计,编写文档初稿、创建数据 第

10、 19 周开发功能模块 第 19 周开发模块功能,测试模块功能并修改 第 19 周整体测试并修改 第 20 周形成项目文档,项目检查,文档检查 3 项目(职员信息管理系统)功能介绍项目(职员信息管理系统)功能介绍 1.添加信息模块:初始化成员信息,包括职工号,姓名,性别,年龄,学历, 工资,住址,电话,给成员排序; 2.删除信息模块:删除某位员工信息数据; 3修改信息模块:依据职工的序号修改某位员工的信息; 4.信息查询模块:依据职员的序号查询某位职员的信息; 5.信息浏览模块:浏览当前所有职员信息; 6:信息排序模块:依据职工号,姓名,薪酬为职工排序; 7:保存信息模块:将所录信息存入文档。

11、 4 项目(职员信息管理系统)功能测试项目(职员信息管理系统)功能测试 测试内容预计实际改善情况 当前信息浏览测试 会出现所有职员信 息 如预计 信息录入测试 依照提示录入职员 信息 如预计 查询测试 按职工号查询按编号查询 按编号查询, 无改动 排序测试按编号排序如预计 删除测试删除职员信息如预计 修改测试改动后信息可存档如预计 新添成员测试增添新成员如预计 保存文件测试文件可正常保存如预计 退出测试 正常退出程序 如预计 5 项目使用说明项目使用说明 将程序正常编译后,按操作提示正常执行;如:当前信息将程序正常编译后,按操作提示正常执行;如:当前信息 浏览输入浏览输入 2,按回车键即可;操

12、作简单,容易掌握,按回车键即可;操作简单,容易掌握, 注意:修改信息后,执行操作注意:修改信息后,执行操作 8,将修改后信息存档。,将修改后信息存档。 6 项目(系统)总结项目(系统)总结 (写出项目实施过程中碰到的问题,如何解决的问题,(写出项目实施过程中碰到的问题,如何解决的问题, 有何收获等)有何收获等) 本次本次 C+实验操作难度大,小组成员分配任务后花费很长时间,实验操作难度大,小组成员分配任务后花费很长时间, 看课本,上网查询资料后,才能正常完成自己所负责模块操作,且看课本,上网查询资料后,才能正常完成自己所负责模块操作,且 程序编写程序编写“巡查模块巡查模块”未如预期,后期改动较

13、大;未如预期,后期改动较大; 通过本次试验,团队成员意识到互相团结协作,交流信息的重要通过本次试验,团队成员意识到互相团结协作,交流信息的重要 性,且认识到自身存在的不足,以后还需多加努力性,且认识到自身存在的不足,以后还需多加努力 附录附录 1 程序源代码程序源代码 #include #include #include #include #include /*employee 职工类*/ class employee public: char*num; char*name; char*sex; int age; char*edu; float salary; char*addres; cha

14、r*tele; int ordernum; employee *next; public: employee() name=NULL; num=NULL; sex=NULL; edu=NULL; salary=0.0; addres=NULL; tele=NULL; ordernum=0; next=NULL; void show() coutnum name sex age edu salary addres tele endl; void show1() cout序号:ordernum 职工号:num 姓名: name 性别:sex 年龄:age 学历:edu 工资:salary 住址:a

15、ddres 电话:telenum=new charstrlen(n)+1; p-name=new charstrlen(name)+1; p-sex=new charstrlen(sex)+1; p-edu=new charstrlen(edu)+1; p-addres=new charstrlen(addres)+1; p-tele=new charstrlen(tele)+1; strcpy(p-num,n); strcpy(p-name,name); strcpy(p-sex,sex); strcpy(p-edu,edu); strcpy(p-addres,addres); strcpy

16、(p-tele,tele); p-salary=sal; p-age=age; num+; p-ordernum=num; for(;q-next!=NULL;q=q-next); q-next=p; /*重载 InfoInput 信息输入*/ void List:InfoInput() employee*p=phead; int number; char num20; char name10; char sex4; int sexnum; int age; char edu10; float sal; char addres50; char tele20; cout请录入信息:endl; c

17、outnumber; for(int i=0;inumber;i+) coutn 输入第i+1个职工的基本信息endl; coutnum; int flag; while(1) flag=0; for(p=phead-next;p;p=p-next) if(strcmp(num,p-num)=0)flag=1;break; if(flag=1) coutnum; else break; coutname; coutsexnum; if(sexnum=1)strcpy(sex,男); else if(sexnum=2)strcpy(sex,女); else coutn 输入有误,重新输入:; w

18、hile(sexnum!=1 coutage; if(age130)cout年龄输入有误,重新输入:; while(age130); coutedu; coutsal; coutaddres; couttele; InfoInput(num,name,sex,age,edu,sal,addres,tele); showall(); /*InfoScan 信息浏览*/ void List:InfoScan() showall(); /*InfoQuery 信息查询*/ void List:InfoQuery() employee*p=phead-next; cout输入查询职工的序号:order

19、; while(ordernum) cout此人不存在,请在 1-numorder; for(int i=0;iordernum=order) p-show1(); break; p=p-next; /*InfoSwap 交换信息函数*/ void List:InfoSwap(employee *p,employee *q) employee temp; temp.num=p-num; p-num=q-num; q-num=temp.num; temp.name=p-name; p-name=q-name; q-name=temp.name; temp.sex=p-sex; p-sex=q-s

20、ex; q-sex=temp.sex; temp.age=p-age; p-age=q-age; q-age=temp.age; temp.edu=p-edu; p-edu=q-edu; q-edu=temp.edu; temp.salary=p-salary; p-salary=q-salary; q-salary=temp.salary; temp.addres=p-addres; p-addres=q-addres; q-addres=temp.addres; temp.tele=p-tele; p-tele=q-tele; q-tele=temp.tele; /*InfoSort 排序

21、*/ void List:InfoSort() employee *p; employee *q; cout-排序方式:-endl; cout|* 1.按职工号升序排列 *|endl; cout|* 2.按姓名升序排列 *|endl; cout|* 3.按职工薪酬升序排列 *|endl; cout-sortway; switch(sortway) case 1: for(int i=0;inext,q=p-next;q;q=q-next,p=p-next) if(strlen(p-num)strlen(q-num) InfoSwap(p,q); coutendl排序后endl; showall

22、(); ;break; case 2: for(int i=0;inext,q=p-next;q;q=q-next,p=p-next) if(strcmp(p-name,q-name)0) InfoSwap(p,q); coutendl排序后endl; showall(); ;break; case 3: for(int i=0;inext,q=p-next;q;q=q-next,p=p-next) if(p-salaryq-salary) InfoSwap(p,q); coutendl排序后next; employee*q=phead; coutordernum; if(ordernumnu

23、m|ordernum=0)cout输入有误!请重新输入 1- numnum|ordernumordernum!=ordernum) p=p-next; q=q-next; coutendl要删除 name 吗?(y/n)sure; if(sure=y) q-next=p-next; delete p-name; delete p-num; delete p-sex; delete p-edu; delete p-addres; delete p-tele; delete p; p=NULL; num-; employee *f=phead-next; for(int i=0;iordernum

24、=i+1; f=f-next; coutendl删除后:endl; showall(); else if(sure=n) coutendl已取消删除next; coutordernum; if(ordernumnum)cout输入有误,请在 1-num范围内选择! num); for(;p-ordernum!=ordernum;p=p-next); cout-要修改的项目:-endl; cout|* 1.职工号 *|endl; cout|* 2.姓名 *|endl; cout|* 3.年龄 *|endl; cout|* 4.学历 *|endl; cout|* 5.工资 *|endl; cout

25、|* 6.住址 *|endl; cout|* 7.电话 *|endl; cout-endl; int item; coutitem; if(item7)cout7); switch(item) case 1: char newnum20; coutnewnum; employee*q; int flag; while(1) flag=0; for(q=phead-next;q;q=q-next) if(strcmp(newnum,q-num)=0)flag=1;break; if(flag=1) coutnewnum; else break; p-num=new charstrlen(newn

26、um)+1; strcpy(p-num,newnum); ;break; case 2: char newname10; coutnewname; p-name=new charstrlen(newname)+1; strcpy(p-name,newname); ;break; case 3: int age; coutage; if(age130)cout年龄输入有误,重新输入:; while(age130); p-age=age; ;break; case 4: char edu40; coutedu; p-edu=new charstrlen(edu)+1; strcpy(p-edu,e

27、du); ;break; case 5: float salary; coutsalary; p-salary=salary; ;break; case 6: char addres30; coutaddres; p-addres=new charstrlen(addres)+1; strcpy(p-addres,addres); ;break; case 7: char tele20; couttele; p-tele=new charstrlen(tele)+1; strcpy(p-tele,tele); ;break; coutendl修改后:show1(); /*showall 显示所

28、有信息 */ void List:showall() employee *p=phead-next; coutendl-endl; cout当前所有职工:endlendl; cout序号 职工号 姓名 性别 年龄 学历 工资 住址 电话endl; cout- -next) coutordernumshow(); coutendl-endl; /*InfoAdd 添加信息*/ void List:InfoAdd() employee*p; char num20; char name10; float sal; char sex4; int sexnum; int age; char edu10;

29、 char addres50; char tele20; cout请输入新添加人员的职工号,姓名,性别,年龄,学历,工资,住 址,电话:endl; coutnum; int flag; while(1) flag=0; for(p=phead-next;p;p=p-next) if(strcmp(num,p-num)=0)flag=1;break; if(flag=1) coutnum; else break; coutname; coutsexnum; if(sexnum=1)strcpy(sex,男); else if(sexnum=2)strcpy(sex,女); else coutn

30、输入有误,重新输入:; while(sexnum!=1 coutage; coutedu; coutsal; coutaddres; couttele; InfoInput(num,name,sex,age,edu,sal,addres,tele); cout添加后:next; ofstream save_diskfile; save_diskfile.open(emplist.txt,ios:out|ios:trunc); if(!save_diskfile) cout打开文件失败; return; for(int i=0;inum;i+) save_diskfilenum name sex

31、 age edu salary addres telenext; save_diskfile.close(); /*List 析构函数*/ List:List() employee *p=phead-next; while(p) phead-next=p-next; delete p-name; delete p-num; delete p-sex; delete p-edu; delete p-addres; delete p-tele; delete p; p=phead-next; delete phead-name; delete phead-num; delete phead-sex

32、; delete phead-edu; delete phead-addres; delete phead-tele; delete phead; phead=NULL; /*Prompt 弹出菜单函数*/ void Prompt() coutendl-请选择菜单:-endl; cout|* 1.信息录入 *| endl; cout|* 2.当前信息浏览 *| endl; cout|* 3.查询 *| endl; cout|* 4.排序 *| endl; cout|* 5.删除 *| endl; cout|* 6.修改 *| endl; cout|* 7.新添人员 *| endl; cout|

33、* 8.保存文件 *| endl; cout|* 0.退出 *| endl; cout-endl; /*ReadFile 读取文件信息函数 */ void ReadFile(List /职工成员信息 char num20; /职工号 char name10; /姓名 char sex4; /性别 int age; /年龄 char edu10; /学历 float sal; /工资 char addres50;/住址 char tele20; /电话 char*pline=line; int flag=0; fstream fileout(emplist.txt,ios:out|ios:app

34、); if(!fileout) coutn 文件打开失败!endl; fileout ; fileout.close(); fstream fileread(emplist.txt,ios:in); if(!fileread) coutn 文件打开失败!endl; char ch; int i=0; fileread.get(ch); if(ch!= ) coutn文件中已有的记录:endlendl; fileread.seekg(0,ios:beg); while(!fileread.eof() i+; fileread.getline(line,sizeof(line); cout lin

35、eendl; if(*pline!= ) for(char*p=line,*q=line;*q!=0;) /读取职工号 sal=0; age=0; for(;*q!= ;q+); *q=0; strcpy(num,p); q+; /读取姓名 for(;*q= ;q+); for(;pq;p+); for(;*q!= ;q+); *q=0; strcpy(name,p); q+; /读取性别 for(;*q= ;q+); for(;pq;p+); for(;*q!= ;q+); *q=0; strcpy(sex,p); q+; /读取年龄 for(;*q= ;q+); for(;pq;p+);

36、for(;*q!= ;q+) age=age*10+*q-0; /读取学历 for(;*q= ;q+); for(;pq;p+); for(;*q!= ;q+); *q=0; strcpy(edu,p); q+; /读取工资 for(;*q= ;q+); for(;pq;p+); for(;*q!= ;q+) if(*q=.)break; if(*q= ) for(;pq;p+)sal=sal*10+*p-0; else float little=0; float t=0.1f; for(;pq;p+) sal=sal*10+*p-0; p+; for(;*q!= ;q+); for(;pq;

37、p+) little=little+(*p-0)*t; t*=0.1f; sal+=little; /读取地址 for(;*q= ;q+); for(;pq;p+); for(;*q!= ;q+); *q=0; strcpy(addres,p); q+; /读取电话 for(;*q= ;q+); for(;pq;p+); for(;*q!=0;q+); strcpy(tele,p); emp.InfoInput(num,name,sex,age,edu,sal,addres,tele); else coutendl文件中无历史记录! endlitem_number; if(item_numbe

38、r8)cout输入有误!请在 0-8 的范围内输入! 8); switch(item_number) case 1:emp.InfoInput();Prompt();goto loop;break; case 2:emp.InfoScan();Prompt();goto loop;break; case 3:emp.InfoQuery();Prompt();goto loop;break; case 4:emp.InfoSort();Prompt();goto loop;break; case 5:emp.InfoDelete();Prompt();goto loop;break; case

39、6:emp.InfoModify();Prompt();goto loop;break; case 7:emp.InfoAdd();Prompt();goto loop;break; case 8:emp.SaveFile();cout保存成功!endl;break; case 0:emp.SaveFile();cout已保存!endl;exit(0); /*main()函数*/ void main() List emp_list; /信息列表对象 coutendl $- -$endl; cout $ * * 职工信息管理系统 * * $endl; cout $- $endl; ReadFile(emp_list); /读取文件 SelectMenu(emp_list);/选择菜单

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

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1