《C++职工工资管理系统代码(共9页).doc》由会员分享,可在线阅读,更多相关《C++职工工资管理系统代码(共9页).doc(9页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、精选优质文档-倾情为你奉上#include#include#includeusing namespace std;class zhigongpublic: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() co
2、utbumen; coutnumber; coutname; private: int number;char name20;char bumen20;class gongzipublic: 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 j
3、intie;double getyilao() return 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;dou
4、ble shuidian;class zhigongzi:public 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. 显示职工信息 *
5、endl;cout* 7. 退出系统 *endl;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;dou
6、ble gangwei;double jintie;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()docout请选择要修改的信息:endl;cout*endl; cout* 1.修改岗位工资 *endl;cout* 2.修改岗位津贴
7、 *endl;cout* 3.修改应交纳水电费 *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);
8、if(flag=0)cout查询不到该工号的职工,按0退出n;elsecoutn; 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; fo
9、r(int i=0;it;i+) if(number=zi.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 按姓名查询-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+)
10、 if(strcmp(name,zi.getname()=0) uj=i;j+; if(j=0) cout没有你要查询的职工名字endl; cout是否继续查询,继续请按1 / 退出按0:n; for(int b=0;bj;b+) if(j2) i=ub; cout职工号 姓名 所属部门 岗位工资 岗位津贴 水电费 医疗保险 应发工资 实发工资endl; coutzi.getnumber()tzi.getname()tzi.getbumen()t zi.getgangwei()tzi.getjintie()tzi.getshuidian()t zi.getyilao()tzi.getyingf
11、a()tzi.getshifa()endl; else i=ub; if(k=2) int flag; int n=1;while(n=1) coutnumber;flag=0; for(int i=0;it;i+) if(number=zi.getnumber() cout职工号 姓名 所属部门 岗位工资 岗位津贴 水电费 医疗保险 应发工资 实发工资endl; coutzi.getnumber()tzi.getname()tzi.getbumen()t zi.getgangwei()tzi.getjintie()tzi.getshuidian()t zi.getyilao()tzi.get
12、yingfa()tzi.getshifa()endl; flag=1; if(flag=0) cout查询不到,按0退出n; else cout是否继续查询,继续请按1 / 退出按0:n; int xianshi(zhigongzi z,int m) cout职工工资信息: endl; cout职工号 姓名 所属部门 岗位工资 岗位津贴 水电费 医疗保险 应发工资 实发工资endl; for(int i=0;im;i+) coutzi.getnumber()tzi.getname()tzi.getbumen()t zi.getgangwei()tzi.getjintie()tzi.getshu
13、idian()t zi.getyilao()tzi.getyingfa()tzi.getshifa()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;专心-专注-专业