#include <iostream>
#include <vector>
using namespace std;
//getData function
vector<double> getData() {
double a, b;
cout << "Enter your mass(kg): ";
cin >> a;
cout << "Enter your height(m): ";
cin >> b;
vector<double> c;
c.push_back(a);
c.push_back(b);
return c;
}
//calcBMI function
double calcBMI(vector<double> c){
double t = c[0] / (c[1] * c[1]);
return t;
}
//displayFitnessResults function
void displayFitnessResults(double t) {
if (t < 18.5)
cout << "Underweight";
if (t >= 18.5 && t < 25)
cout << "Healthy";
if (t >= 25 && t < 30)
cout << "Overweight";
if (t >= 30)
cout << "Obese";
}
int main() {
vector<double> c;
double t;
c=getData();
t = calcBMI(c);
displayFitnessResults(t);
return 0;
}
Comments
Leave a comment