課題を手伝ってもらえますか? テスト ケースを取り込んで、小数点以下 1 桁の BMI を生成する BMI Calculator を作成する必要がありました。私のコードは、フィート = 4、インチ = 10、ポンド = 1000 の場合を除いて、ほとんどのケースに合格します。期待される結果は 209.0 で、209 しか出力されません。if ステートメントを作成して、 「.0」またはそれをコーディングする方法はありますか?
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
double feet, inches, pounds, bmi;
cout << "== BMI Calculator ==" << endl;
cout << "Step 1: Enter height" << endl;
cout << "Feet:" << endl;
cin >> feet;
cout << "Inches:" << endl;
cin >> inches;
cout << "Step 2: Enter weight" << endl;
cout << "Pounds:" << endl;
cin >> pounds;
inches = (feet * 12) + inches;
bmi = ((pounds * 703) / (inches * inches));
bmi = ceil(bmi * 10) / 10;
cout << "BMI: " << bmi << endl;
if (bmi < 18.5)
cout << "you are underweight." << endl;
else if (bmi >= 18.5 && bmi < 25)
cout << "you are normal." << endl;
else if (bmi >= 25 && bmi <= 29.9)
cout << "you are overweight." << endl;
else
cout << "you are obese." << endl;
}