如此简单的程序,竟不知如何改提示的那个错了..
#include"iostream.h"#include"string.h"
class Person
{
private:
char *name,sex[10],id[10];
float hour,salary,unitwage;
public:
void information();
void show();
};
void main()
{
Person li;
li.information();
cout<<"now output the person's salary:";
li.show();
}
void Person::information()
{
cout<<"input personal information!:"<<endl;
cout<<"please input name:"<<endl;
cin>>name>>endl;
cout<<"please input hour:"<<endl;
cin>>hour>>endl;
cout<<"please input id:"<<endl;
cin>>id>>endl;
cout<<"please input sex:"<<endl;
cin>>sex>>endl;
cout<<"please input unitwage:"<<endl;
cin>>unitwage>>endl;
}
void Person::show()
{
cout<<"name"<<name<<"id"<<id<<endl;
if(0<hour<=40)
cout<<"salary="<<hour*unitwage<<endl;
if(40<hour<=60)
cout<<"salary="<<40*unitwage+(hour-40)*1.5*unitwage<<endl;
if(hour>60)
cout<<"salary="<<40*unitwage+20*1.5*unitwage+(hour-60)*3*unitwage<<endl;
}
C:\Documents and Settings\Administrator\桌面\勤の卿\My Program\C++程序设计与应用\salary\salary.cpp(30) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'class ostream &(__cdecl *)(class ostream &)'
(or there is no acceptable conversion)