int main (int argc, char * const argv[]) {
float height_cm, weight_kg, height_inch, weight_pound, ur_bmi, ur_bmi_inpound;
char height_unit = 'a', weight_unit = 'a';
std::cout << "Welcome to the BMI Centre.\n";
do {
std::cout << "Please select the unit of your height:\n";
std::cout << "Press I for inch. Press C for centimeter.\n";
std::cin >> height_unit;
if (height_unit=='I') {
std::cout << "Please enter your height:\n";
std::cin >> height_inch;
}
else if(height_unit=='C') {
std::cout << "Please enter your height:\n";
std::cin >> height_cm;
}
} while (height_unit != 'I'||height_unit != 'C');
do {
std::cout << "Please select the unit of your weight:\n";
std::cout << "Press P for pound. Press K for kilogram.\n";
std::cin >> weight_unit;
if (weight_unit=='P') {
std::cout << "Please enter your weight:\n";
std::cin >> weight_pound;
}
else if(weight_unit=='C'); {
std::cout << "Please enter your weight:\n";
std::cin >> weight_kg;
}
} while (weight_unit!='P'||weight_unit!='K');
@aizat
This is your program using functions. Not sure what you mean by
in array
Anyway, hope this is of use. I changed it to either - or for American and Metric. Otherwise, weight could be entered in pounds and height in centimeters.
thank u my friend, this program using the process (do_while) right? right now i need to convert it to (two dimensional arrays) or (switch case)...thnk u for ur help..