不知小子 发表于 2015-4-13 21:01:21

Help

编译时出现“D:\C程序\practice\e9_11.cpp(59) : fatal error C1004: unexpected end of file found”求大神解决啊~!


#include <iostream.h>
class Employee
{
public:
        Employee(char nm[],int id)
        {name=nm;ID=id;}
        ~Employee(){};
        int getid(){return ID;}
        char *getid(int id){ID=id;}
        void setid (int id){ID=id;}
        void setname(char nm[]){name=nm;}
        virtual int pay()=0;
        virtual void print()=0;
protected:
        char *name;
        int ID;
};
class Manager:public Employee
{
public:
        Manager(char nm[],int id,int sl):Employee(nm,id)
        {sal=sl;}
        ~Manager(){};
        int getsal(){return sal;}
        void setsal(int sl){sal=sl;}
        int pay(){return sal;}
        void print()
        {
                cout<<endl<<"name:"<<name<<"         ID:"<<ID<<"pay="<<pay()<<endl;
        }
protected:
        int sal;
};
class Hourlyworker:public Employee
{
public:
Hourlyworker(char nm[],int id,int w,int h):Employee(nm,id)
{wage=w;hour=h;}
~Hourlyworker(){};
int getwage(){return wage;}
void setwage(int w){wage=w;}
int gethours(){return hours;}
void sethours(int h){houes=h;}
int pay(){return hours*wage;}
void print()
{
        cout<<"\nname:"<<name<<"       ID:"<<ID<<"pay="<<pay()<<endl;
protected:
        int wage;
        int hours;
};
void main()
{
        Manager manag("zhang",101,9000);
    Hourlyworker hourw("li",112,30,8*29);
    manag.print ();
        hourw.print();
}


仰望天上的光 发表于 2015-4-13 21:42:46

class Hourlyworker的void print()函数最后少个}

沫丶尛希 发表于 2015-4-14 01:36:32

{:1_1:}
页: [1]
查看完整版本: Help