1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#include <iostream>
#include <cmath>
#include <cstdlib>
using std::cin; using std::cout; using std::endl;
double bmrmen(double h, double w, double a);
double bmrwomen(double h, double w, double a);
const int cpg = 354;
int main(){
cout << "Enter gender [m/f]: ";
char gen;
cin >> gen;
if (gen = 'm'){
cout << "Input height, weight, and age: \n";
double h, w, a;
cin >> h >> w >> a;
bmrmen(h, w, a);
} else if (gen = 'f'){
cout << "Input height, weight, and age: \n";
double h, w, a;
cin >> h >> w >> a;
bmrwomen(h, w, a);
}
}
double bmrmen(double h, double w, double a){
cin >> h >> w >> a;
double bmr = 66 + (6.3 * w) + (12.9 * h) - (6.8 * a);
return bmr;
}
double bmrwomen(double h, double w, double a){
cin >> h >> w >> a;
double bmr = 655 + (4.3 * w) + (4.7 * h) - (4.7 * a);
return bmr;
}
|