程序如下:(可以见附件) #include<iostream.h> class employee { public: int getage() const; void setage(int age); int getyearsofservice()const; void setyearsofservice(int years); int getsalary() const; void setsalary(int salary); private: int age; int yearsofservice; int salary; }; int main() { employee john; employee sally; john.setage(30); john.setyearsofservice(5); john.setsalary(50000); sally.setage(32); sally.setyearsofservice(8); sally.setsalary(40000); cout<<"john is"<<john.getage<<"years old and he has been with"; cout<<"the firm for"<<john.getyearsofservice<<"year .\n"; cout<<"john earns $"<<john.getsalary()<<"dollars per year. \n\n"; return 0; } 为什么编译时报这种错误: Compiling... 61.cpp C:\myvc\61\61.cpp(26) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type '' (or there is no acceptable conversion) C:\myvc\61\61.cpp(27) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type '' (or there is no acceptable conversion) Error executing cl.exe.
61.exe - 2 error(s), 0 warning(s)