您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 质量控制/管理 > C语言结课大作业--完整的系统设计
职工信息管理系统设计职工信息包括职工号、姓名、性别、年龄、学历、工资、住址、电话等(职工号不重复)。试设计一职工信息管理系统,使之能提供以下功能:系统以菜单方式工作职工信息录入功能(职工信息用文件保存)--输入职工信息浏览功能--输出查询和排序功能:(至少一种查询方式)--算法按工资查询按学历查询等职工信息删除、修改功能(任选项)#includeiostream#includestring#includefstreamusingnamespacestd;constN=50;//定义系统可录入的员工最大数值stringEname[N];longEnum[N];charEsex[N];intEage[N];charEmarriage[N];intEdepart[N];intEposition[N];intEdegree[50];intEworktime[N];floatEpay[N];classEmployee{public:stringEmployeename;longEmployeenum;charEmployeesex;intEmployeeage;charEmployeemarriage;intEmployeedepart;intEmployeeposition;intEmployeedegree;intEmployeeworktime;floatEmployeepay;staticlongEmployeeMaxNum;staticfloatEmployeeBasePay;voidNewInfo();voidShowInfo();voidshowall();voidshowdepart(intdepart);voidshowdegree(intdegree);voidshowage(intmin,intmax);voidshownum(longnumber);voidRefreshInfo();voidDeleteInfo();floatPay(intEmployeegrade);staticintMaxNum();};classDBOperate{public:stringEmployeename;longEmployeenum;charEmployeesex;intEmployeeage;charEmployeemarriage;intEmployeedepart;intEmployeeposition;intEmployeedegree;intEmployeeworktime;floatEmployeepay;staticlongEmployeeMaxNum;staticfloatEmployeeBasePay;voidWriteIn(intiflag);voidReadOut();voidRefreshMaxNum(intiflag);//i=1or-1or0};longEmployee::EmployeeMaxNum=1000;floatEmployee::EmployeeBasePay=1500;intEmployee::MaxNum()//返回系统已经存储的人数{intMN=0;ifstreammyf;myf.open(EmployeeMaxNum.txt);myfMN;coutMNendl;myf.close();returnMN;}voidEmployee::NewInfo()//添加新成员函数{cout新员工姓名:;cinEmployee::Employeename;Employee::Employeenum=EmployeeMaxNum+Employee::MaxNum()+1;cout新员工性别(F为女性,M为男性):;cinEmployee::Employeesex;cout新员工年龄:;cinEmployee::Employeeage;cout新员工婚姻状况(Y为已婚,N为未婚):;cinEmployee::Employeemarriage;cout新员工学历,请输入相应学历的序号:endl;cout[1:初中2:高中3:本科4:硕士5:博士];cinEmployee::Employeedegree;while(Employee::Employeedegree!=1&&Employee::Employeedegree!=2&&Employee::Employeedegree!=3&&Employee::Employeedegree!=4&&Employee::Employeedegree!=5){cout输入有误,请重新输入:endl;cout[1:初中2:高中3:本科4:硕士5:博士];cinEmployee::Employeedegree;}cout新员工所在部门,请输入相应部门的序号:endl;cout[1:董事会2:市场部3:公关部4:客服中心5:信息中心];cinEmployee::Employeedepart;while(Employee::Employeedepart!=1&&Employee::Employeedepart!=2&&Employee::Employeedepart!=3&&Employee::Employeedepart!=4&&Employee::Employeedepart!=5){cout输入有误,请重新输入:endl;cout[1:董事会2:市场部3:公关部4:客服中心5:信息中心];cinEmployee::Employeedepart;}cout新员工职位,请输入相应职位的序号:endl;cout[1:临时职员2:正式职员3:主任4:部门经理5:董事长];cinEmployee::Employeeposition;while(Employee::Employeeposition!=1&&Employee::Employeeposition!=2&&Employee::Employeeposition!=3&&Employee::Employeeposition!=4&&Employee::Employeeposition!=5){cout输入有误,请重新输入:endl;cout[1:临时职员2:正式职员3:主任4:部门经理5:董事长];cinEmployee::Employeeposition;}cout新员工的工作时(不需要输入单位):;cinEmployee::Employeeworktime;Employee::Employeepay=Employee::Pay(Employee::Employeeposition);DBOperatedbo;dbo.ReadOut();intMaxNum=Employee::MaxNum();Enum[MaxNum]=Employee::Employeenum;Ename[MaxNum]=Employee::Employeename;Esex[MaxNum]=Employee::Employeesex;Eage[MaxNum]=Employee::Employeeage;Emarriage[MaxNum]=Employee::Employeemarriage;Edegree[MaxNum]=Employee::Employeedegree;Edepart[MaxNum]=Employee::Employeedepart;Eposition[MaxNum]=Employee::Employeeposition;Eworktime[MaxNum]=Employee::Employeeworktime;Epay[MaxNum]=Employee::Employeepay;dbo.WriteIn(1);cout添加新成员成功!endl;return;}voidEmployee::ShowInfo()//程序主体数据输出函数{intchoice1,choice2,min,max;longsearchnum;Employeee;cout请选择查询方式:endl;cout******************************************endl;cout*输出全体职工信息---------------------1endl;cout*按职工部门输出-----------------------2endl;cout*按职工学历输出-----------------------3endl;cout*按职工年龄输出-----------------------4endl;cout*按职工编号输出-----------------------5endl;cout******************************************endl;cinchoice1;switch(choice1){case1:showall();break;case2:cout请输入要查询职工的部门编号:[1:董事会2:市场部3:公关部4:客服中心5:信息中心];cinchoice2;e.showdepart(choice2);break;case3:cout请输入要查询职工的学历编号:[1:初中2:高中3:本科4:硕士5:博士];cinchoice2;e.showdegree(choice2);break;case4:cout请输入要查询的年龄范围:;cout最小值:;cinmin;cout最大值:;cinmax;e.showage(min,max);break;case5:cout请输入要查询的员工号:;cinsearchnum;e.shownum(searchnum);break;default:cout出错啦!endl;break;}}voidEmployee::showall()//全体员工输出函数{inti;longnumber;for(i=0;iEmployee::MaxNum();i++){number=Enum[i];shownum(number);}}voidEmployee::showdepart(intdepart)//按员工所在部门输出函数{inti;switch(depart){case1:cout董事会的成员有:endl;break;case2:cout市场部的成员有:endl;break;case3:cout公关部的成员有:endl;break;case4:cout客服中心成员有:endl;break;case5:cout信息中心成员有:endl;break;default:cout输入错误!endl;break;}for(i=0;iEmployee::MaxNum();i++){if(Edepart[i]==depart){longnumber=Enum[i];shownum(number);}elsecontinue;}}voidEmployee::showdegree(intdegree)//按员工学历输出函数{inti;switch(degree){case1:cout初中学历的员工有:endl;break;case2:cout高中学历的员工有:endl;break;case3:cout本科学历的员工有:endl;break;case4:cout硕士学位的员工有:endl;break;case5:cout博士学位的员工有:endl;break;}for(i=0;iEmployee::MaxNum();i++){if(Edegree[i]==degree){longnu
本文标题:C语言结课大作业--完整的系统设计
链接地址:https://www.777doc.com/doc-4386852 .html