#include <iostream>
#include <iomanip>
#include <cstring>
#include <cmath>
using namespace std;

double getBMI(double weg, double tall);
void dispStatus(double BMI); 


int main()
{
	int b, c, d;
	double a, x, y, z, ovheg, ovweg;
	char name[50];
	
	cout << setprecision(4);
	
	
	cout << "Enter name or press <ENTER> key to end  ";
	cin.getline(name, 50);
	while(strlen(name) != 0)
	{
		cout << "Enter weight (kg) and height (m)  " << endl;
		cin >> a >> x;
		cin.ignore();
	
		ovweg += a;
		ovheg += x;
	
		y = getBMI(a, x);	
	
		cout << "Name   : " << name << endl;
		cout << "Weight : " << a << endl;
		cout << "Height : " << x << endl;
		cout << "BMI    : " << y << endl;
		cout << "Status : ";
		dispStatus(y);
	
	
		cout << "Enter name or press <ENTER> key to end  ";
		cin.getline(name, 50);
	}
	
	z = getBMI(ovweg, ovheg);
	cout << "Overall BMI : " << z << endl;
	cout << "Overall Status : ";
	dispStatus(z);
	
	
	system("pause");
	return 0;
}

double getBMI(double weg, double tall)
{
	double a;
	a= weg / pow(tall, 2);
	return a;
}

void dispStatus(double BMI)
{
	if(BMI < 18.5)
	{
		cout << "Underweight" << endl;
	}
	else if(BMI >= 18.5 && BMI <= 25)
	{
		cout << "Normal" << endl;
	}
	else if(BMI > 25 && BMI <= 30)
	{
		cout << "Overweight" << endl;
	}
	else
	{
		cout << "Obese" << endl;
	}
}
