第1个回答 推荐于2017-06-14
#include <stdio.h>
int main( )
printf("请输入 体重(千克)和身高(米):");
scanf("%f%f",&w,&h);
bmi=w/(h*h);
printf("%.2f\n",bmi);
return 0;
}本回答被网友采纳
第2个回答 2020-03-18
#include<iostream>
using namespace std;
int main()
{
cout << "Enter weight in pounds:";
double weight;
cin >> weight;
cout << "Enter height in inches:";
double height;
cin >> height;
const double KILOGRAMS_PER_POUND = 0.45359237;
const double METERS_PER_INCH = 0.0254;
double weightInKilongrams = weight * KILOGRAMS_PER_POUND;
double heightInMeters = height * METERS_PER_INCH;
double bmi = weightInKilongrams /
(heightInMeters*heightInMeters);
cout << "BMI is" << bmi << endl;
if (bmi < 18.5)
cout << "Underweight" << endl;
else if (bmi < 25)
cout << "Normal" << endl;
else if (bmi < 30)
cout << "Overweight" << endl;
else
cout << "Obese" << endl;
return 0;
}