BMI- calculator

Hej. There's a problem, that I can't find so please help. "Dizagnoza" shows "niedowaga" before each diagnose after third "if".
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 #include <iostream>

using namespace std;
double wzrost, waga, BMI;
int main()
{
    cout << "Ile ważysz?(kg):" << endl;
    cin >>waga;
    cout<< "Ile masz wzrostu?(m):"<<endl;
    cin>>wzrost;
    BMI=waga/(wzrost*wzrost);
    cout<<"Twoje BMI wynosi:"<<BMI <<endl;
    cout<<"Diagnoza:";
    if( (BMI<16)&&(BMI>=0)) cout<<"wygłodzenie";
    if( (BMI<17)&&(BMI>=16)) cout<<"wychudzenie";
    if( (BMI<18,5)&&(BMI>=17))cout<<"niedowaga";
    if( (BMI<25)&&(BMI>=18.5))cout<<"waga prawidlowa";
    if( (BMI<30)&&(BMI>=25))cout<<"nadwaga";
    if( (BMI<35)&&(BMI>=30))cout<<"pierwszy stopien otylosci";
    if( (BMI<40)&&(BMI>=35))cout<<"drugi stopien otylosci";
    if(BMI>=40) cout<<"trzeci stopien otylosci";



    return 0;
}
Last edited on
1n line 16 use decimal point instead of decimal comma
Topic archived. No new replies allowed.