请指教一下下面这个程序的问题,编译的时候是if语句有问题,难道来里面成员函数的的结果不能作比较??
#include"iostream"using namespace std;
class student
{public:
student(int,int,int);
int complex();
int age;
int height;
int weight;
};
student::student(int h,int w,int a)
{height=h;
weight=w;
age=a;
}
int student::complex()
{int z;
z=(height-weight)/2+age;
return z;
}
main()
{student stu1(172,60,22),stu2(180,70,25);
cout<<"the compex is "<< ()<<endl;
cout<<"age is "<<stu1.age<<endl<<"height is "<<stu1.height<<endl<<"weight is "<<stu1.weight<<endl;
cout<<"the compex is "<< ()<<endl;
cout<<"age is "<<stu2.age<<endl<<"height is "<<stu2.height<<endl<<"weight is "<<stu2.weight<<endl;
if( ()>int ())
cout<<"stu1 is more healthy";
else
cout<<"stu2 is more healthy";
return 0;
}
提示的错误是:D:\VC store\practice 03.cpp(28) : error C2440: 'type cast' : cannot convert from 'int (__thiscall student::*)(void)' to 'int'
请指教