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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
#include <iostream>
#include <stdlib.h>
using namespace std;
float bmiNumber(float pounds, float inches) //BMI calculation
{
return ((pounds/inches)*703);
}
void chart(int mF)
{
if(mF==2) {
cout<<"\nHere is some info you might find useful...\n"
<<"At the same BMI, women tend to have more body fat than men."<<endl
<<"From cdc.gov\n"<<endl;
}
}
void history()
{
cout<<"Version History"<<endl;
cout<<"\tVersion 1.0.1(05/18/2012)"<<endl
<<"Optimized source code for better program flow,\nImproved calculation methods,\n"
<<"Introduded looping capabilities for\nmultiple calculations without restarting the program."<<endl;
cout<<"\tVersion 1.0.0(05/15/2012)"<<endl
<<"Creation of the program, very rough outline of the basic structure."<<endl;
system ("pause");
}
int main()
{
int changes;
int m;
m=1;
cout<<"Hello and welcome to the BMI Calculation Tool 1.0.1, or BMICT1.0.1 for short."<<endl;
cout<<"If you would like to see the changes from the previous version(1.0.0)\nplease press 3..."<<endl;
cout<<"If not press any other key.";
cin>>changes;
if(changes==3)
{
history();
}
cout<<endl<<endl<<endl;
cout<<"Why don't you first tell me a little bit about yourself,\nby answering just one simple question."<<endl;
cout<<"Are you a man or a woman?";
while(m==1)
{
cout<<"If you are a man, please press 1,\nif you are a woman, please press 2."<<endl;
cout<<"Please make your selection now..."<<endl;
cin>>m;
if(m==1)
{
cout<<"Our sources have indicated that you are in fact a man,\n"
<<"please check to confirm this and continue with the program"<<endl;
}
else if(m==2)
{
cout<<"Our sources have indicated that you are a woman,\n"
<<"if this is true please continue with the program"<<endl;
}
else
{
cout<<"You have entered an incorrect key..."<<endl;
cout<<"The program will now close.\n";
system ("pause");
return 0;
}
chart(m);
float feet;
float inch;
float totalinches;
cout<<"Please enter your height as follows..."<<endl;
cout<<"Number of feet: "<<endl;
cin>>feet;
cout<<"\nNumber of inches: "<<endl;
cin>>inch;
totalinches=(feet*12)+inch;
cout<<"Your total height in inches is: "<<totalinches<<endl;
float inchSqd;
float lbs;
float BMI;
inchSqd=(totalinches*totalinches);
cout<<"Please enter your weight in pounds: \n";
cin>>lbs;
cout<<"Okay, we will now calculate your BMI\n";
BMI=bmiNumber(lbs, inchSqd);
cout<<endl
<<"Your Body Mass Index Number is: "<<BMI<<endl;
cout<<endl<<"Once again your BMI is "<<BMI<<", and here is a chart for review."<<endl;
cout<<endl
<< "\tWeight Status"<<endl
<<" Below 18.5 Underweight"<<endl
<<" 18.5 to 24.9 Normal"<<endl
<<" 25.0 to 29.9 Overweight"<<endl
<<" 30.0 and Above Obese"<<endl;
cout<<"If you would like to make another calculation press 1, if not press 2..."<<endl;
cin>>m;
}
cout<<endl<<"Thank you for using the BMICT1.0.1 and have a great day.\n";
system ("pause");
return 0;
}
|