资源预览内容
第1页 / 共12页
第2页 / 共12页
第3页 / 共12页
第4页 / 共12页
第5页 / 共12页
第6页 / 共12页
第7页 / 共12页
第8页 / 共12页
第9页 / 共12页
第10页 / 共12页
亲,该文档总共12页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
源代码#include #include #include #include double Cwage; double Swage; double Mwage; int ID; class Ddegree protected: int Num; char Name20; char Sex10; int Borntime; int Age; int degree; double Salary; Ddegree *next; public: Ddegree(char ID,char *Ename,char *Esex,int Eborntime,int Edegree) this-Num=ID; strcpy(this-Name,Ename); strcpy(this-Sex,Esex); this-Borntime=Eborntime;this-degree=Edegree; void Getage()Age=2009-Borntime;virtual void Calcwage()=0; virtual void Output()=0; friend class Company; ; class Xxs:public Ddegree private: double Workload; public: Xxs(char ID,char *Ename,char *Esex,int Eborntime,int Edegree,double Eworkload):Ddegree(ID,Ename,Esex,Eborntime,Edegree) this-Workload=Eworkload; double GetWorkload() return Workload; void SetWorkload(double Amount) this-Workload=Amount; void Calcwage() Salary=Cwage+Workload*20; void Output() Getage();Calcwage(); coutNumtNametSextBorntime年tAge岁t小学生tSalaryWorkload=Eworkload; double GetWorkload() return Workload; void SetWorkload(double Amount) this-Workload=Amount; void Calcwage() Salary=Swage+Workload*20+1000; void Output() Getage();Calcwage(); coutNumtNametSextBorntime年tAge岁t初中生tSalaryWorkload=Eworkload; double GetWorkload() return Workload; void SetWorkload(double s) Workload=s; void Calcwage() Salary=Mwage+Workload*20+1000; void Output() Getage();Calcwage(); coutNumtNametSextBorntime年tAge岁t高中生tSalaryendl; ; class Dxs:public Ddegree public: Dxs(char ID,char *Ename,char *Esex,int Eborntime,int Edegree):Ddegree(ID,Ename,Esex,Eborntime,Edegree) void Calcwage() Salary=Mwage+2000; void Output() Getage();Calcwage(); coutNumtNametSextBorntime年tAge岁t大学生tSalarynext; delete Worker; Worker=p; Worker=0; char Name20; void Add(); void Modify(); void Delete(); void Query(); void Set(); void Save(); ; void Company:Add() Ddegree *p; char Name20; char Sex10; int Borntime; int degree; double Workload; coutn* 新增职工 *n; coutID; coutName;coutSex;coutBorntime;coutdegree; while(degree !=1°ree !=2°ree !=3°ree !=4) cout输入有误,请重新输入:endl; coutdegree; if(degree!=4) coutWorkload; switch(degree) case 1:p=new Xxs(ID,Name,Sex,Borntime,degree,Workload); break; case 2:p=new Czs(ID,Name,Sex,Borntime,degree,Workload); break; case 3:p=new Gzs(ID,Name,Sex,Borntime,degree,Workload); break; case 4:p=new Dxs(ID,Name,Sex,Borntime,degree); break; p-next=0; if(Worker) Ddegree *p2; p2=Worker; while(p2-next) p2=p2-next; p2-next=p; else Worker=p; cout新增职工成功!endl; void Company:Modify() int Num; int degree=NULL; double Workload; coutn* 修改职工信息 *n; coutNum; Ddegree *p1,*p2; p1=Worker; while(p1) if(p1-Num=Num) break; else p2=p1; p1=p1-next; if(p1!=NULL) p1-Output(); coutp1-Name; coutp1-Sex;coutp1-Borntime;if(degree=1) coutWorkload; (Xxs *)p1)-SetWorkload(Workload); else if(degree=2) coutWorkload; (Czs *)p1)-SetWorkload(Workload); else if(degree=3) coutWorkload; (Gzs *)p1)
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号