I'm trying to make a basic program to calculate the Body Mass Index using with the options of the imperial system and the option of the metric system by using functions. I'm not sure whats wrong with the code. Any advice would be appreciated.
Code:
#include <iostream.h>
#include <stdlib.h>
double CalcBMI(double HEIGHT, double WEIGHT, char MEASURE)
{
int bmi;
if (MEASURE == m)
bmi = ((WEIGHT/(HEIGHT*HEIGHT)*10000);
else
bmi = ((WEIGHT/(HEIGHT*HEIGHT)*703);
return bmi;
}
int main()
{
double height, weight, BMI;
char measure;
cout << "Enter the measure (imperial = i or metric = m) being used: " << endl;
cin >> measure;
cout << "Enter your height (in inches for imperial, in centimetres for metric): " << endl;
cin >> height;
cout << "Enter your weight (in pounds for imperial, in kilograms for metric): " << endl;
cin >> weight;
BMI = CalcBMI(height, weight, measure);
cout << "Your body mass index is: " << BMI << endl;
system("PAUSE");
return 0;
}