这道题请大佬们指点一下,谢谢了!
#include <iostream>
#include <iomanip>
int main()
{
float weight = 0.0f;
float height = 0.0f;
float bmi = 0.0f;
std::cout << std::fixed << std::setprecision(2);
do
{
std::cin >> weight >> height;
bmi = weight / (height * height);
std::cout << "体重指数" << bmi << ',';
if (bmi < 18.5f)
std::cout << "偏瘦";
else if (bmi < 24.0f)
std::cout << "正常体重";
else if (bmi < 27.0f)
std::cout << "轻微肥胖";
else if (bmi < 30.0f)
std::cout << "中度肥胖";
else
std::cout << "重度肥胖";
std::cout << '\n';
} while (weight != 0.0 && height != 0.0f);
return 0;
}