新手:C++出现 “People::getAnswer”: 非标准语法;请使用 "&" 来创建
class People
{
private:int myweight;
double myheight;
double mybmi;
public:
People() :myweight(0), myheight(0.0), mybmi(0.0){}
People(int weight,double height):myweight(weight),myheight(height){}
void calculatebmi() { mybmi= myweight / myheight * myheight; }
void getAnswer(){
calculatebmi();
if (mybmi > 23.9)cout << "Yes!" << endl;
else cout << "No!" << endl;
}
};
C++出现 “People::getAnswer”: 非标准语法;请使用 "&" 来创建
请问应该怎样修改我的代码呢?
谢谢各位大佬了