#include <iostream>
#include <cmath>

using namespace std;

float getBMI(float w, float h)
{
	float bmi = w / pow(h,2);
	return bmi;
}

void dispStatus(float bmi)
{
	if (bmi < 18.5)
	cout << "Status\t\t: Underweight";
	else if (bmi >= 18.5 && bmi <= 25)
		cout << "Status\t\t: Normal";
	else if (bmi > 25 && bmi <= 30)
		cout << "Status\t\t: Overweight";
	else
		cout << "Status\t\t: Obese";
		
}

int main()
{
	char name[30];
	float weight, height, get_bmi;
	cout << "Please Enter a Name or Press any key to End\n" << "Name: ";
	cin >> name;
	
	while (name != "E")
	{
	cout << "Please Enter Weight (kg) and Height (m)\n" << "Weight (kg): ";
	cin >> weight;

	while (weight <= 0)
	{
		cout << "Invalid Input! Please try again\n" << "Weight (kg): ";
		cin >> weight;
	}
	
	cout << "\nHeight (m): ";
	cin >> height;
	
	while (height <= 0)
	{
		cout << "Invalid Input! Please try again\n" << "Height (m): ";
		cin >> height;
	}
	
	get_bmi = getBMI(weight, height);
	
	cout << "Name\t\t: " << name << endl;
	cout << "Weight (kg)\t\t: " << weight << endl;
	cout << "Height (m)\t\t: " << height << endl;
	cout << "BMI\t\t: " << get_bmi << endl;
	dispStatus(get_bmi);
	cout << endl;
	
	cout << "Please Enter a Name or Press any key to End\n" << "Name: ";
	cin >> name;
	}
	
	return 0;
	
}
	
	
