主题:“为什么连不上” 帮忙 纯技术问题!!
别看编码很长其实问题很简单 不看下面的程序就可以回答了!!!
class Employee
{
protected:
char name[20];
int individualEmpNo;
int grade;
float accumPay;
static int employeeNo;
public:
Employee();
~Employee();
void play();
void promote(int);
void SetName(char *);o
chvidualEmpNo();
int Getgradar *GetName();
int Getindie();
float GetaccumPay();
};
class Technician:public Employee
{
private:
float hourlyRate;
int workHours;
public:
Technician();
void SetworkHours(int wh);
void play();
};
class Salesman:virtual public Employee
{
protected:
float CommRate;
float sales;
public:
Salesman();
void Setsales(float s1);
void play();
};
class Manager:virtual public Employee
{
protected:
float monthlyPlay;
public:
Manager();
void pay();
};
class Salesmanager:public Manager ,public Salesman
{
public:
Salesmanager();
void play();
};
#include<iostream>
#include<cstring>
#include"Employee.h"
using namespace std;
int Employee::employeeNo=1000;
Employee::Employee()
{
individualEmpNo=employeeNo++;
grade=1;
accumPay=0.0;
}
Employee::~Employee(){}
void Employee::play(){}
void Employee::promote(int increment)
{
grade+=increment;
}
void Employee::SetName()(char *names)
{
strcpy(name names);
}
char *Employee::GetName()
{return name;}
int Empioyee::GetindualEmpNo()
{return intividualEmpNo;}
int Employee::Getgrade()
{return grade;}
float Employee::GetaccumPay()
{return accumPay;}
Technician::Technician()
{hourlyRate=100;}
void Technician::SetworkHours(int wh)
{workHours=wh;}
void Technician::play()
{accumPay=hourlyRate *workHours;}
Salesman::Salesman()
{CommRate=0.04;}
void Salesman::Setsales(float s1)
{sales =s1;}
void Salesman::play()
{accumPay=sales *CommRate;}
Manager::Manager()
{monthlyPay=8000;}
void Manager::pay()
{accumPay=monthlyPay;}
Salesmanager::Salesmanager()
{monthlyPay=5000;
CommRate=0.005;}
void Salesmanager::pay()
{accumPay=monthlyPay+CommRate*sales;}
#include<iostream>
#include<cstring>
#include<Employee.h>
using namespace std;
int main()
{Manager m1;
Technician t1;
Salesmanager sm1;
Salesman s1;
char namestr[20];
cout<<"请输入下一个雇员的名字";
cin>>namestr;
m1.SetName(namestr);
cout<<"请输入下一个雇员的名字";
cin>>namestr;
t1.SetName(namestr);
cout<<"请输入下一个雇员的名字";
cin>>namestr;
sm1.SetName(namestr);
cout<<"请输入下一个雇员的名字";
cin>>namestr;
s1.SetName(namestr);
m1.promote(3);
m1.pay();
cout<<"请输入兼职技术人员"<<ti.GetName()<<"本月的工作时数:";
int ww;
cin>>ww;
t1.SetworkHours(ww);
t1.promote(2);
t1.pay();
cout<<"请输入销售经理"<<sm1.GetName()<<"本月的销售额:";
float s1;
sm1.Setsales(s1);
sm1.pay();
sm1.promote(2);
cout<<"请输入推销员;";<<s1.GetName()<<"所管辖部门本月的销售总额";
cin>>s1;
s1.Setsales(s1);
s1.pay();
cout<<m1.GetName()<<"编号"<<m1.GetindividualEmpNo()<<"级别为"<<m1.Getgrade()<<“级,本月工资"<<m1.GetaccumPay()<<endl;
cout<<t1.GetName()<<"编号"<<t1.GetindividualEmpNo()<<"级别"<<sm1.Getgrade()<<"级,本月工资"<<sm1.GetaccumPay()<<endl;
cout<<si.GetName()<<"编号"<<si.GetindividualEmpNo()<<"级别"<<s1.Getgrade()<<"级,本月工资"<<s1.GetaccumPay()<<endl;
}
编译的时候运行错误 显示c:\program files\microsoft visual studio\myprojects\实现文件.cpp(3) : fatal error C1083: Cannot open include file: 'Employee.h': No such file or directory
我把头文件定义在一个工程的头文件中 把实现文件和主函数文件定义在另一个工程中 为什么错误显示找不到头文件???
急切需求大家的帮助!!