#include <iostream>
using namespace std;

class BMI {
private:
    double weight, height, bmi;
public:
    BMI(double w, double h) : weight(w), height(h / 100), bmi(0) {}

    void calculate() { bmi = weight / (height * height); }

    void classify() {
        if (bmi < 18.5) cout << "저체중" << endl;
        else if (bmi < 23) cout << "정상" << endl;
        else if (bmi < 25) cout << "과체중" << endl;
        else cout << "비만" << endl;
    }
};

int main() {
    double w, h;
    cin >> w >> h;
    BMI b(w, h);
    b.calculate();
    b.classify();
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: