《C++职工工资管理系统代码.pdf》由会员分享,可在线阅读,更多相关《C++职工工资管理系统代码.pdf(9页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、-.-.可修编.#include#include#include using namespace std;class zhigong public:void setnumber(int n)number=n;void setname(char*na)strcpy(name,na);void setbumen(char*bu)strcpy(bumen,bu);int getnumber()return number;char*getname()return name;char*getbumen()return bumen;void setzhigong()coutbumen;coutnumber
2、;coutname;private:int number;char name20;char bumen20;class gongzi public:void setgangwei(double g)gangwei=g;void setjintie(double j)jintie=j;void setyiliao(double y)yiliao=y;void setshuidian(double s)shuidian=s;double getgangwei()return gangwei;double getjintie()return jintie;double getyilao()retur
3、n yiliao;double getshuidian()return shuidian;double getyingfa()return(gangwei+jintie);double getshifa()return(gangwei+jintie-shuidian-yiliao);void setgongzi()coutgangwei;coutjintie;coutshuidian;-.-.可修编.coutyiliao;private:double gangwei;double jintie;double yiliao;double shuidian;class zhigongzi:publ
4、ic zhigong,public gongzi public:void setzhigongzi()setzhigong();setgongzi();void menu()cout*endl;cout-职工工资管理系统(小蛇制作)-endl;cout*endl;cout*1.输 入 职 工 信 息 *endl;cout*2.修 改 职 工 工 资 *endl;cout*3.添 加 职 工 信 息 *endl;cout*4.删 除 职 工 信 息 *endl;cout*5.查 询 职 工 工 资 *endl;cout*6.显 示 职 工 信 息 *endl;cout*7.退 出 系 统 *en
5、dl;cout*endl;-.-.可修编.int i=-1;int shuru(zhigongzi z)ofstream ofile(D:zhigong.dat,ios:binary);if(!ofile)cout文件夹不能打开.endl;return 0;while(1)int p=1;while(p=1)i+;zi.setzhigongzi();ofile.write(char*)&zi,sizeof(zhigongzi);cout输入成功!endl;coutp;return i+1;ofile.close();int t,number;double gangwei;double jint
6、ie;double yiliao;double shuidian;char name20;int xiugai(zhigongzi z,int m)ofstream ofile(D:zhigong.dat,ios:binary);int flag;int n=1;while(n=1)-.-.可修编.coutnumber;flag=0;int a;for(int i=0;im;i+)if(number=zi.getnumber()do cout请选择要修改的信息:endl;cout*endl;cout*1.修改岗位工资 *endl;cout*2.修改岗位津贴 *endl;cout*3.修改应交纳
7、水电费 *endl;cout*4.修改应交纳医疗保险费用 *endl;cout*endl;couta;if(a=1)coutgangwei;zi.setgangwei(gangwei);if(a=2)coutjintie;zi.setjintie(jintie);if(a=3)coutshuidian;zi.setshuidian(shuidian);if(a=4)coutyiliao;zi.setyiliao(yiliao);ofile.write(char*)&zi,sizeof(zhigongzi);flag=1;while(a4);if(flag=0)-.-.可修编.cout查询不到该
8、工号的职工,按 0 退出n;else coutn;coutendl;ofile.close();return 0;int tianjia(zhigongzi z,int m)int n=1;while(n=1)cout请输入要添加的新职工信息endl;zt.setzhigongzi();cout添加成功!;t+;cout是否继续添加,继续请按 1/退出请按 0:n;return t;void shanchu(zhigongzi z,int m)int flag;int n=1;while(n=1)coutnumber;flag=0;for(int i=0;it;i+)if(number=zi.
9、getnumber()int k;k=i;for(k;kt;k+)-.-.可修编.zk=zk+1;t=t-1;flag=1;cout*删除成功*endl;if(flag=0)cout查询不到该工号的职工,无法删除按 0 退出n;else coutn;void chaxun(zhigongzi z,int m)cout-1 按 XX 查询-endl;cout-2 按工号查询-endl;coutk;if(k=1)int u10;int n=1;while(n=1)coutname;int j=0;for(int i=0;it;i+)if(strcmp(name,zi.getname()=0)uj=
10、i;j+;if(j=0)cout没有你要查询的职工名字endl;cout是否继续查询,继续请按 1/退出按 0:n;-.-.可修编.for(int b=0;bj;b+)if(j2)i=ub;cout职工号 XX 所属部门 岗位工资 岗位津贴 水电费 医疗保险 应发工资 实发工资endl;coutzi.getnumber()tzi.getname()tzi.getbumen()t zi.getgangwei()tzi.getjintie()tzi.getshuidian()t zi.getyilao()tzi.getyingfa()tzi.getshifa()endl;else i=ub;if(
11、k=2)int flag;int n=1;while(n=1)coutnumber;flag=0;for(int i=0;it;i+)if(number=zi.getnumber()cout职工号 XX 所属部门 岗位工资 岗位津贴 水电费 医疗保险 应发工资 实发工资endl;coutzi.getnumber()tzi.getname()tzi.getbumen()t zi.getgangwei()tzi.getjintie()tzi.getshuidian()t zi.getyilao()tzi.getyingfa()tzi.getshifa()endl;flag=1;if(flag=0)
12、cout查询不到,按 0 退出n;else-.-.可修编.cout是否继续查询,继续请按 1/退出按 0:n;int xianshi(zhigongzi z,int m)cout职工工资信息:endl;cout职工号 XX 所属部门 岗位工资 岗位津贴 水电费 医疗保险 应发工资 实发工资endl;for(int i=0;im;i+)coutzi.getnumber()tzi.getname()tzi.getbumen()t zi.getgangwei()tzi.getjintie()tzi.getshuidian()t zi.getyilao()tzi.getyingfa()tzi.gets
13、hifa()endl;return 0;int main()zhigongzi z20;int a;while(1)menu();coutendl;cout-请输入序号选择对应功能-endl;coutendl;couta;switch(a)case 1:system(cls);t=shuru(z);break;-.-.可修编.case 2:system(cls);xiugai(z,t);break;case 3:system(cls);tianjia(z,t);break;case 4:system(cls);shanchu(z,t);break;case 5:system(cls);chaxun(z,t);break;case 6:system(cls);xianshi(z,t);break;case 7:exit(0);system(pause);system(cls);return 0;