我正在尝试做一个基本的BMI计算器,并且它在我测量它的指标时正常工作,但是,皇家方面会返回错误的答案。BMI计算器错误
cout << "What is your weight? ";
cin >> weight;
cout << "What is your height in either inches or meters? ";
cin >> height;
cout << "Is that metric or imperial? Type 1 for metric, or 0 for imperial ";
cin >> unit;
if (unit = 1)
answer = weight/(height * height);
if (unit = 0)
answer = (weight * 703)/(height * height);
cout << "Your BMI is " << answer << endl;
system("PAUSE");
return 0;
我以为方程BMI为英制,根据维基百科
重量(磅)* 703 /(英寸身高的平方)
哦哇,菜鸟的错误。谢谢!=) – user1768884