C++工资管理系统链表编.doc_第1页
C++工资管理系统链表编.doc_第2页
C++工资管理系统链表编.doc_第3页
C++工资管理系统链表编.doc_第4页
C++工资管理系统链表编.doc_第5页
免费预览已结束,剩余14页可下载查看

下载本文档

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

文档简介

#include#include#include#include#include#includevoid menu6()system(cls);cout *修改信息*nendl;cout endl;cout | |endl;cout | 1.编号 |endl;cout | 2.姓名 |endl;cout | 3.性别 |endl;cout | 4.年龄 |endl;cout | 5.部门 |endl;cout | 6.联系方式 |endl;cout | 7.奖金 |endl;cout | 8.扣发工资 |endl;class workfriend class manage;protected:int ID; /编号char name20; /姓名char age5; /性别int gender; /年龄 char department20; /部门int year; /参加工作时间(年)int month; /月int day; /日char contact20; /联系方式double bonus; /奖金double salary; / 扣发工资work *next;public:double wages; /总工资virtual void input(void);virtual work()=0;virtual void output(void)=0;virtual int getnumber(void)=0;virtual void change(void)=0;virtual char *getname(void)=0;virtual void save(void)=0;work:work()void work:input()int i;coutID;coutendlname;docoutendlage;if(strcmp(男,age)!=0&strcmp(女,age)!=0)i=1;cout你输入的性别不合法,请重新输入:;else i=0;while(i);docoutendlgender;if(gender100)i=1;cout你输人的年龄不合法,请重新输入:;else i=0;while(i);coutendldepartment;docoutendlyear;if(year2014)i=1;cout你输人的年份不合法,请重新输入:;else i=0;while(i);docoutendlmonth;if(month12)i=1;cout你输入的月份不合法,请重新输入:endl;else i=0;while(i);docoutendlday;if(month=1|month=3|month=5|month=7|month=8|month=10|month=12)if(day31)i=1; cout你输入的日子不合法,请重新输入:;else i=0;if(month=4|month=6|month=9|month=11)if(day30)i=1; cout你输入的日子不合法,请重新输入:;else i=0;if(month=2)if(day%4=0&day%100!=0)|(day%400=0)if(day29)i=1; cout你输入的日子不合法,请重新输入:;else i=0;while(i);coutendlcontact;coutendlbonus;coutendlsalary;class manager: virtual public work /经理protected: char rank20; /级别double allowance; /职务津贴static int a;public:void input();void output();void change();int getnumber()return(ID);char * getname()return (name);static void get()cout总共保存的经理人数为:aendl;manager()a-;void save();void manager:save()ofstream file;file.open(manager.txt,ios:out|ios:app);if(file.fail()cerr文件打开失败endl;return;fileID name age gender department year month day contact rank allowanceendl; file.close();void manager:input()work:input();coutendlrank;coutendlallowance;a+;void manager:output()cout经理的编号:IDendl;cout 姓名:nameendl;cout 性别:ageendl;cout 年龄:genderendl;cout 工作部门:departmentendl;cout 级别:rankendl;cout 参加工作时间:year年month月day日endl;cout 参加工作为yearendl;cout 联系方式:contactendl;cout 实发工资:5000+bonus-salary+allowanceendl; void manager:change()int i;domenu6();cout | 9.级别 |endl;cout | 10.职务津贴 |endl;cout | 0.返回上一界面 |endl;coutendl;couti;switch(i)case 1:coutID; break;case 2:coutendlname;break;case 3:coutendlage;break;case 4: coutendlgender;break;case 5:coutendldepartment;break;case 6: coutendlcontact;break;case 7:coutendlbonus;break;case 8:coutendlsalary;break;case 9: coutendlrank;break; case 10:coutendlallowance;break;case 0: return ;default:coutn没有此选项.请重选.endl;break;cout修改成功。endl;system(pause);while(1);class salesman: virtual public work /销售人员protected:float sale; /销售额;float ratio; /提成比例;static int b;public:void input();void output();void change();int getnumber()return(ID);char * getname()return(name);salesman()b-;static void get()cout你输入的销售员的总人数为:bendl;void save();void salesman:save()ofstream file;file.open(salesman.txt,ios:out|ios:app);if(file.fail()cerr文件打开失败endl;return;fileID name age gender department year month day contact sale ratioendl; file.close();void salesman:input()work:input();coutendlsale;coutendlratio;b+;void salesman:output()cout销售员的编号:IDendl;cout 姓名:nameendl;cout 性别:ageendl;cout 年龄:genderendl;cout 工作部门:departmentendl;cout 参加工作时间:year年month月day日endl;cout 联系方式:contactendl;cout 实发工资:3000+bonus-salary+(sale*ratio)endl; void salesman:change()int i;do menu6();cout | 9.销售额 |endl;cout | 10.提成比例 |endl;cout | 0.返回上一界面 |endl;coutendl;couti;switch(i)case 1:coutID;break;case 2:coutendlname;break;case 3:coutendlage;break;case 4: coutendlgender;break;case 5:coutendldepartment;break;case 6: coutendlcontact;break;case 7:coutendlbonus;break;case 8: coutendlsalary;break;case 9: coutendlsale;break;case 10:coutendlratio;break;case 0:return ;default:coutn没有此选项.请重选.endl;break;while(1);class artisan:public work /技术人员protected:char title20; /职称double allowance; /职务津贴static int c;public:void input();void output();void change();int getnumber()return (ID);char * getname()return (name);artisan()c-;static void get()cout你输入的技术员的总人数为:cx-ID x-name x-age x-gender x-department x-year x-month x-day x-contact x-title x-allowance; file.close();return (x);void artisan:save()ofstream file;file.open(artisan.txt,ios:out|ios:app);if(file.fail()cerr文件打开失败endl;return;fileID name age gender department year month day contact title allowanceendl; file.close();void artisan:input()work:input();coutendltitle;coutendlallowance;c+;void artisan:output()cout技术员的编号:IDendl;cout 姓名:nameendl;cout 性别:ageendl;cout 年龄:genderendl;cout 工作部门:departmentendl;cout 职称:titleendl;cout 参加工作时间:year年month月day日endl;cout 联系方式:contactendl;cout 实发工资:7000+bonus-salary+allowanceendl; void artisan:change()int i;domenu6();cout | 9.职称 |endl;cout | 10.职称津贴 |endl;cout | 0.返回上一界面 |endl;coutendl;couti;switch(i)case 1:coutID;break;case 2:coutendlname;break;case 3:coutendlage;break;case 4: coutendlgender;break;case 5:coutendldepartment;break;case 6: coutendlcontact;break;case 7:coutendlbonus;break;case 8:coutendlsalary;break;case 9: coutendltitle;break; case 10:coutendlallowance;break;case 0:return ;default:coutn没有此选项.请重选.endl;break;while(1);class Smanager:public manager,public salesman /销售经理protected:static int d;public:void input();void output();void change();int getnumber()return (ID);char * getname()return (name);Smanager()d-;static void get()cout你输入的销售经理总人数为:dx-ID x-name x-age x-gender x-department x-year x-month x-day x-contact x-rank x-allowance x-sale x-ratio; file.close();return (x);void Smanager:save()ofstream file;file.open(Smanager.txt,ios:out|ios:app);if(file.fail()cerr文件打开失败endl;return;fileID name age gender department year month day contact rank allowance sale ratioendl; file.close();void Smanager:input()int i=0;work:input();coutendlrank;coutendlallowance;coutendlsale;coutendlratio;d+;void Smanager:output()cout销售经理的编号:IDendl;cout 姓名:nameendl;cout 性别:ageendl;cout 年龄:genderendl;cout 级别:rankendl;cout 参加工作时间:year年month月day日endl;cout 工作部门:departmentendl;cout 联系方式:contactendl;cout 实发工资:5000+bonus-salary+allowance+(sale*ratio)endl;void Smanager:change()int i;domenu6();cout | 9.级别 |endl;cout | 10.职务津贴 |endl;cout | 11.销售额 |endl;cout | 12.提成比例 |endl;cout | 0.返回上一界面 |endl;coutendl;couti;switch(i)case 1:coutID;break;case 2:coutendlname;break;case 3:coutendlage;break;case 4: coutendlgender;break;case 5:coutendldepartment;break;case 6: coutendlcontact;break;case 7:coutendlbonus;break;case 8:coutendlsalary;break;case 9: coutendlrank;break;case 10:coutendlallowance;break;case 11: coutendlsale;break;case 12:coutendlratio;break;case 0:return ;default:coutn没有此选项.请重选.endl;break;while(1);class manage /经理管理protected:work *head;public:manage()head=0;void add(); / 新增void change(); /修改void Search(); /查询void Delete(); /删除void Total(); /统计void save(); /保存文件;void manage:add()work *x,*y;int m,n=0;while(1)system(cls);cout *增加菜单*nendl;cout endl;cout | |endl;cout | 1.增加 经理信息 |endl;cout | 2.增加 销售人员信息 |endl;cout | 3.增加 技术人员信息 |endl;cout | 4.增加 销售经理信息 |endl;cout | 0.返回主界面 |endl;coutendl;coutn;switch(n)case 1:x=new manager; break;case 2: x=new salesman;break;case 3: x=new artisan;break; case 4: x=new Smanager;break;case 0: return;default:coutn没有此选项.请重选.input();if(head!=0)n=x-getnumber();for(y=head;y!=0;y=y-next) if(n=y-getnumber()cout输入的编号重复!请再次输入的编号:next=0;elsey=head;while(y-next)y=y-next;y-next=x;x-next=0;cout您已经成功添加。(继续添加请按“1”结束请按“0”)m;m=1;void manage:change()work *y;int n;cout请输人你要修改的编号:n;for(y=head;y!=0;y=y-next)if(n=y-getnumber()y-change();system(pause);void manage:Search()work *x;int i,n;char s20;if(head=0)cout记录为空!endl;system(pause);return;dosystem(cls);cout *查询信息*nendl;cout endl;cout | |endl;cout | 1.按编号 查找 |endl;cout | 2.按姓名 查找 |endl;cout | 0.返回上一界面 |endl;coutendl;couti;switch(i)case 1:cout请输入你要查询的编号:n;for(x=head;x!=0;x=x-next)if(n=x-getnumber()x-output();system(pause);elsecout未查到你所输入的信息endl;break;case 2: cout请输人你要查询的性名:s;for(x=head;x!=0;x=x-next)if(strcmp(s,x-getname()=0)x-output ();system(pause);elsecout未查到你所输入的信息endl;break;case 0:return ;default:coutn没有此选项.请重选.endl;break;while(1);void manage:Delete()work *x,*y;int i,n,m,t;char s20;if(head=0)cout记录为空!endl;system(pause);return;dosystem(cls);cout *删除信息*nendl;cout endl;cout | |endl;cout | 1.按编号 删除 |endl;cout | 2.按姓名 删除 |endl

温馨提示

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

评论

0/150

提交评论