#include <iostream> #include <cmath> #include <iomanip> #include <fstream> using namespace std; void Calculate (double, double, int); double Calc_Ideal (double, int); double Calc_Lean (double, double, int); double Calc_BMI (double, double); int main(){ int choice, gender; double height, weight; cout << "BODY COMPOSITION PROGRAM" << endl << endl; cout << "Menu Choices: "<< endl<<endl; cout << " 0 - Quit" << endl <<" 1 - Enter your height (inches) & weight (lbs.) & gender (1=female & 2=male)"<<endl<< " 2 - Calculate IBW, LBW, and BMI"<<endl<<endl; cout << "Please enter your choice: "; cin >> choice; if(choice==2){ cout<<endl<<"ERROR: Insufficient Data!"<<endl<<endl; cout << "BODY COMPOSITION PROGRAM" << endl<<endl; cout << "Menu Choices: "<< endl<<endl; cout << " 0 - Quit" << endl <<" 1 - Enter your height (inches) & weight (lbs.) & gender (1=female & 2=male)"<<endl<< " 2 - Calculate IBW, LBW, and BMI"<<endl<<endl; cout << "Please enter your choice: "; cin >> choice; } if(choice==1){ cout<<endl<<"Enter your height in inches and weight in pounds: "; cin>>height>>weight; cout<<endl<<"Enter your gender (1 = Female & 2 = Male): "; cin>>gender; if(gender==1 || gender==2){ void Calculate (double, double, int); } else{ cout<<"ERROR: Invalid Gender!"<<endl<<endl; return 0; }} } void Calculate (double height, double weight, int gender){ double ideal, idealpounds, lean, leanpounds, BMI; double Calc_Ideal (double, int); cout <<"Your ideal body weight is "<<ideal<<" kg = " <<idealpounds<< " lb."<<endl; double Calc_Lean (double, double, int); cout <<"Your lean body weight is "<<lean<<" kg = "<<leanpounds<<" lb."<<endl; double Calc_BMI (double, double); cout <<"Your Body Mass Index was determined to be "<<BMI<<"."; if(BMI<25){ cout <<"According to the National Heart, Lung, and Blood Institute you would be classified as normal."; } if(BMI<30){ cout <<"According to the National Heart, Lung, and Blood Institute you would be classified as overweight."; } else{ cout <<"According to the National Heart, Lung, and Blood Institute you would be classified as obese."; }} double Calc_Ideal (double height, int gender){ double ideal, idealpounds; if(gender=1){ ideal= 45.5 + 2.3 * (height - 60); idealpounds = ideal/2.2026; } if(gender=2){ ideal = 50 + 2.3 * (height - 60); idealpounds = ideal/2.2026; } return ideal, idealpounds; } double Calc_Lean (double height, double weight, int gender){ double lean, leanpounds; if(gender=1){ lean = (1.07 * (weight)) - (148 * (pow(weight,2) /(100 * pow(height,2)))); leanpounds=lean/2.2026; } if(gender=2){ lean = ((1.10 * (weight)) - (128 * (pow(weight,2) /(100 * pow(height,2))))); leanpounds=lean/2.2026; } return lean; } double Calc_BMI (double height, double weight){ double BMI; BMI = weight/pow(height,2); return BMI; }

*edit: Please use code tags in the future, thanks!

This post has been edited by **Martyr2**: 15 February 2009 - 10:37 PM