请问各个大哥林姐出错在那里,给小弟指点下,谢谢!

来源:百度文库 编辑:神马文学网 时间:2024/07/05 16:59:29
employee.h
#ifndef EMPLOY_H
#define EMPLOY_H
#include
#include
using namespace std;
class Employee
{
public:
Employee(string);
virtual float Count() const=0;
virtual void print() const=0;
virtual~Employee(){}
protected:
string name;
};
#endif
employee.cpp
#include
using namespace std;
#include   "employee.h"
Employee::Employee(string s){name=s;}
director.h
#ifndef DIRECT_H
#define DIRECT_H
#include "employee.h"
class Director: public Employee
{private:
float Year_Salary;
public :
Director(string,float=0.0);
void SetYearSalaary(float);
virtual float Count()const;
virtual void print() const;
};
#endif
director.cpp
#include "director.h"
Director::Director(string name,float s):Employee(name)
{Year_Salary=s>0? s:0;}
void Director::SetYearSalary(float s){Year_Salary=s>0? s:0;}
float Director::Count()const
{  return Year_Salary;}
void  Director::Print()const
{ cout<<"\n Director:"<commis.h
#ifndef COMMIS1_H
#define COMMISI2_H
#include "employee.h"
class Salesman:public Employee
{private;
float salary;float sale;int quantity;
public:
Salesman (string,float=0.0,float=0.0,int=0.0);
void SetSalary(float,float,int);
virtual float Count()const;
virtual void Print()const;
};
#endif;
commis.cpp
#include "commis.h"
Salesman::Salesman(string name,float s,float c,int q):Employee(name)
{salary=s>0? s:0 sale=c>0? c:0;quantity=q>0? q:0;}
void Salesman::SetSalary(float s,float c,int q)
{salary=s>0? s:0;
sale=c>0? c:0;
quantity=q>0? q:0;}
float Salesman::Count()const
{return salary+sale*quantity;}
void Salesman::Print()const
{cout<<"\nSalesman:"<hourly.h
#ifndef HOURLY1_H
#define HOURLY1_H
#include"employee.h"
class Hourly Worker:public Employee
{private:
float hourly ;float hours;
public:
Hourly Worker(string,float=0.0,float=0.0);
void SetHoursWage(float,float);
virtual float Count()const;
virtual void Print()const;
};
#endif
hourly.cpp
#include "hourly.h"
HourlyWorker::HourlyWorker(string name,float w,float h,):Employee(name)
{houry=w>0? w:0;
hours=h>=0&&h<168? h:0;
}
void Hourly Worker::SetHoursWage(float w,float h)
{hourly=w>0? w:0;
hours=h>=0&&h<168? h:0;
}
float  Hourly Worker::Count()const
{return hourly*hours;}
void  Hourly Worker::Print()const
{cout<<"\n Hourly Worker:"<main.cpp
#include
#include"employee.h"
#include "director.h"
#include "commis.h"
#include"hourly.h"
void Fun(Employee &p)
{p.Print();
cout<<"\tearned\t$"<}
void Fun(Employee*p)
{p->Print();
cout<<"\tearned\t$"<Count();
}
void main()
{cout<Employee*ep;
Director b("Bleriot");
b.SetYearSalary(800.00);
ep=&b;
ep->Print();
cout<<"tearned\t$"<Count();
Saleaman c("Johnny",200.0.3.0.150);
Fun(c);
Hourly Worker h("Karen",13,75,40);
Fun(h);
cout<}
----------------------------------------------------------------------------------------------------------------
--------------------Configuration: sss - Win32 Debug--------------------
Compiling...
sss.cpp
C:\Windows\System32\sss.cpp(1) : error C2143: syntax error : missing ';' before '.'
C:\Windows\System32\sss.cpp(1) : error C2501: 'employee' : missing storage-class or type specifiers
C:\Windows\System32\sss.cpp(1) : error C2143: syntax error : missing ';' before '.'
g:\program files\microsoft visual studio\vc98\include\errno.h(29) : error C2143: syntax error : missing ';' before '{'
g:\program files\microsoft visual studio\vc98\include\errno.h(29) : error C2447: missing function header (old-style formal list?)
C:\Windows\System32\sss.cpp(31) : error C2143: syntax error : missing ';' before '.'
C:\Windows\System32\sss.cpp(31) : error C2501: 'employee' : missing storage-class or type specifiers
C:\Windows\System32\sss.cpp(31) : error C2086: 'employee' : redefinition
C:\Windows\System32\sss.cpp(31) : error C2143: syntax error : missing ';' before '.'
C:\Windows\System32\sss.cpp(37) : fatal error C1083: Cannot open include file: 'employee.h': No such file or directory
执行 cl.exe 时出错.
sss.obj - 1 error(s), 0 warning(s)