问题 c++6.0 unexpected end of file while looking for precompiled header directive

来源:百度知道 编辑:UC知道 时间:2024/06/27 16:05:57
#include<iostream.h>
#include<string.h>
class Employee
{
public:
Employee()
{
cout<<"职工编号、姓名:";
cin>>no>>name;
salary=0;
}
virtual void Pay()=0;
virtual void Display()=0;
protected:
int no;
char name[10];
float salary;
};
class Technician:public Employee
{
public:
Technician(int n,char *p,float h,int w)
{
no=n;
strcpy(name,p);
salary=0;
hourlyrate=h;
workhours=w;
}
virtual void Pay()
{
salary=hourlyrate*workhours;
}
void Display()
{
cout<<"兼职技术人员"<<name<<"(编号为"<<no<<")"<<"本月工资:"<<salary<<endl;
}
private:
float hourlyrate;
int workhours;
};
class Salesman:virtual public Employee
{
public:
Salesman(int n,ch

我在vc6.0下直接编译就通过了啊

在vc++中正常运行。建议你重新建立工程,然后 把以上文件粘贴到新建的c++source file 中试试。

1.英文版的:在project->setting->c/c++ ->category里选 precompiled header 然后在下面选not using precompiled header
2.中文版的工程---设置---c/c++---在分类里面选“预编译头文件”----不使用预补偿页眉---确定。
3.删除程序中的 #include “stdio.h”