current position:Home>How can the last line end with 0 without spaces

How can the last line end with 0 without spaces

2022-02-02 18:42:27 CSDN Q & A

Please give me some advice on this problem , Thank you for the !

img




Refer to the answer 1:
#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 << " Body mass index " << bmi << ',';        if (bmi < 18.5f)            std::cout << " Thin ";        else if (bmi < 24.0f)            std::cout << " Normal weight ";        else if (bmi < 27.0f)            std::cout << " Slight obesity ";        else if (bmi < 30.0f)            std::cout << " Moderate obesity ";        else            std::cout << " Severe obesity ";        std::cout << '\n';    } while (weight != 0.0 && height != 0.0f);    return 0;}



Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202021842256610.html

Random recommended