基本的な 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 / (高さの平方インチ)