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\");
}
}