cout <<"Please enter your gender. M or F"<<endl;
cin>>gender;
if (gender == 'F')
female (cmm) ;
else
return 0;
}
float female (float bmi)
{
float weight;
float height;
char response;
do
{
cout << "*****************************\n";
cout << "Please enter your weight (kg): ";
cin >> weight;
cout << "Please enter your height (m): ";
cin >> height;
bmi = weight/(height*height);
cout<<"\n";
cout << fixed << showpoint << setprecision(2);
cout<<"Your BMI is " << bmi << endl;
if (bmi < 18.5)
{
cout << "You are underweight!" << endl;
cout << "Eat more!!" << endl;
}
else if (bmi >= 18.5 && bmi <25)
{
cout << "You are normal!"<<endl;
cout << "You are cool!"<<endl;
}
else if (bmi >= 25 && bmi <30)
{
cout << "You are overweight!"<<endl;
cout << "You should diet!"<<endl;
}
else if (bmi >= 30)
{
cout << "You are obesity!"<<endl;
cout << "You should do more exercise!"<<endl;
}
else
cin.get();
cin.get();
cout << endl;
cout << "Would you like to enter the information again? ";
cin >> response;
}
while (toupper(response) == 'Y');
cout << "Okay, see you next time.." << endl;
return 0;
}
why do you even have cmm in main, if your main is not even utilizing it .. just delete float cmm;
and declare and initialize it in you function where you need to use it.