有一个BUG异常 求各位帮帮吧
有一个BUG错误 求各位帮帮吧?
/************************/
/* example of 5.7 */
/************************/
#include<iostream>
#include<string>
using namespace std;
/*********************************************************/
/* class of Employee */
/*********************************************************/
class Employee
{
protected:
char *name; //the number of employee
int individualEmpNo;
int grade; //work position
float accumPay;
static int employeeNo; //The max number of compus emploayee number
public:
Employee()
{name=new char[];
individualEmpNo=employeeNo++;
cout<<"职工姓名:";
cin>>name;
accumPay=0.0;
}
~Employee()
{
cout<<"destructe employee class"<<endl;
}
virtual void pay()=0;
//virtual void promote(); //the money of promote
virtual void displayStatus();
};
/*********************************************************/
/* class of Technician */
/*********************************************************/
class Technician:public Employee
{
private:
float hourlyRate; //the salary of a hour
int workHours; //work hour
public:
Technician()
{
hourlyRate=100;
cout<<name<<"本月工作时间:";
cin>>workHours;
}
void pay()
{
accumPay=hourlyRate*workHours;
}
void displayStatus()
{
cout<<"兼职技术人员:"<<name<<",编号:";
cout<<individualEmpNo<<",本月工资:"<<accumPay<<endl;
}
};
/*********************************************************/
/* class of Manager */
/*********************************************************/
class Manager:virtual public Employee
{
protected:
float monthlyPay;
public:
Manager()
{
monthlyPay=8000;
}
void pay()
{
accumPay=monthlyPay;
}
void displayStatus()
{
cout<<"经理:"<<name<<",编号:";
cout<<individualEmpNo<<",本月工资:"<<accumPay<<endl;
}
};
/*********************************************************/
/* class of Salesman */
/*********************************************************/
class Salesman:virtual public Employee
{
protected:
float commRate;
float sales; //salary of monthy
public:
Salesman()
{
commRate=0.04f;
cout<<name<<"本月销售额:";
cin>>sales;
}
void pay()
{
accumPay=sales*commRate;
}
void display()
{
cout<<"销售员:"<<name<<",编号:";
cout<<individualEmpNo<<",本月工资:"<<accumPay<<endl;
}
};
/*********************************************************/
/* class of Salesmanager */
/*********************************************************/
class Salesmanager:public Manager,public Salesman
{
public:
Salesmanager()
{
monthlyPay=5000;
commRate=0.05f;
cout<<name<<"所管部门月销售量:";
cin>>sales;
}
void pay()
{