哪里出错了这个程序输出结果错了
来源:百度知道 编辑:UC知道 时间:2024/05/22 16:20:03
#include <iostream.h>
class bmi //BMI算法的肥胖公式
{
private:
float high,weight;
public:
bmi (float h,float w);//构造函数,公有成员与私有成员参数名不要一样
float Getbmi();//BMI算法的肥胖公式
};//类定义结束
bmi::bmi (float h,float w)//给出类的函数成员
{high=h,weight=w;}
float bmi::Getbmi()
{return weight/(high*high);} //BMI算法的肥胖公式
void main() //主函数开始
{
float high,weight,result;
cout << "Please enter you high and weight:" << endl;
cin >>high,weight;
bmi b(high,weight);
result=b.Getbmi();
cout << "The result is:" <<result<< endl;
}
class bmi //BMI算法的肥胖公式
{
private:
float high,weight;
public:
bmi (float h,float w);//构造函数,公有成员与私有成员参数名不要一样
float Getbmi();//BMI算法的肥胖公式
};//类定义结束
bmi::bmi (float h,float w)//给出类的函数成员
{high=h,weight=w;}
float bmi::Getbmi()
{return weight/(high*high);} //BMI算法的肥胖公式
void main() //主函数开始
{
float high,weight,result;
cout << "Please enter you high and weight:" << endl;
cin >>high,weight;
bmi b(high,weight);
result=b.Getbmi();
cout << "The result is:" <<result<< endl;
}
bmi::bmi (float h,float w)//给出类的函数成员
{high=h,weight=w;}
float bmi::Getbmi()
{return weight/(high*high);} //BMI算法的肥胖公式
void main() //主函数开始
{
float high,weight,result;
cout << "Please enter you high and weight:" << endl;
cin >>high,weight;
@
cout << "The result is:" <<result<< endl;