您好,欢迎来到华佗小知识。
搜索
您的当前位置:首页C++工资程序

C++工资程序

来源:华佗小知识


#include

using namespace std;

class Emploryee

{

protected:

char Name[10];

char Num[5];

int Work_Age;

double Totle_Salary;

public:

virtual void Get_Message();

virtual void Pay()=0;

void Show_Message();

};

class Manager:virtual public Emploryee

{

protected:

float Salary;

public:

Manager(){};

void Get_Message();

void Pay();

~Manager(){};

};

class Worker:public Emploryee

{

protected:

float Salary;

int Work_Hour;

public:

Worker(){};

void Get_Message();

void Pay();

~Worker(){};

};

class Sell:virtual public Emploryee

{

protected:

float Sale;

public:

Sell(){};

void Get_Message();

void Pay();

~Sell(){};

};

class Sell_Manager:public Sell,public Manager

{

public:

Sell_Manager(){};

void Get_Message();

void Pay();

~Sell_Manager(){};

};

void Emploryee::Get_Message()

{

cout<<\"请输入姓名:\";

cin>>Name;

cout<<\"请输入编号:\";

cin>>Num;

}

void Emploryee::Show_Message()

{

cout<cout<cout<}

void Manager::Get_Message()

{

Emploryee::Get_Message();

cout<<\"请输入固定工资:\";

cin>>Salary;

cout<<\"请输入工龄:\";

cin>>Work_Age;

cout<}

void Manager::Pay()

{

Totle_Salary=Salary+Work_Age*50;

}

void Worker::Get_Message()

{

Emploryee::Get_Message();

cout<<\"请输入固定工资:\";

cin>>Salary;

cout<<\"请输入工时:\";

cin>>Work_Hour;

cout<<\"请输入工龄:\";

cin>>Work_Age;

}

void Worker::Pay()

{

Totle_Salary=Salary+Work_Hour*100+Work_Age*50;

}

void Sell::Get_Message()

{

Emploryee::Get_Message();

cout<<\"请输入工龄:\";

cin>>Work_Age;

cout<<\"请输入销售额:\";

cin>>Sale;

cout<}

void Sell::Pay()

{

Totle_Salary=Work_Age*50+Sale*0.05;

}

void Sell_Manager::Get_Message()

{

Emploryee::Get_Message();

cout<<\"请输入固定工资:\";

cin>>Salary;

cout<<\"请输入工龄:\";

cin>>Work_Age;

cout<<\"请输入销售额:\";

cin>>Sale;

cout<}

void Sell_Manager::Pay()

{

Totle_Salary=Salary+Work_Age*50+Sale*0.05;

}

void main()

{

char yn;

int n;

// Emploryee *s[4]={new Manager,new Worker,new Sell,new Sell_Manager};

Emploryee *s[4];

s[0]=new Manager ;

s[1]=new Worker;

s[2]=new Sell;

s[3]=new Sell_Manager;

while(1)

{

cout<cout<<\" 0-经理 \"<cout<<\" 1-工人 \"<cout<<\" 2-销售员 \"<cout<<\" 3-销售经理 \"<cout<<\"请输入:\";

cin>>n;

cout<s[n]->Get_Message();

s[n]->Pay();

s[n]->Show_Message();

cout<cin>>yn;

if(yn!='Y'&&yn!='y')

break;

system(\"cls\");

}

}

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- huatuo0.cn 版权所有 湘ICP备2023017654号-2

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务