Skip to content

Instantly share code, notes, and snippets.

@nitrix
Created September 12, 2012 00:51
Show Gist options
  • Save nitrix/3703359 to your computer and use it in GitHub Desktop.
Save nitrix/3703359 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <iomanip>
using namespace std;
double getBMI (int h, int w, double s)
{
cout << "h: " << h << endl;
cout << "w: " << w << endl;
cout << "s: " << s << endl;
return w / (h*h);
}
void output (double b)
{
cout << b << endl;
}
int main()
{
int height1, height2, weight1, weight2;
double bmi1, bmi2;
double scalar = 703.0;
cout << "Person 1 height:" << endl;
cin >> height1;
cout << "Person 1 weight:" << endl;
cin >> weight1;
cout << "Person 2 height:" << endl;
cin >> height2;
cout << "Person 2 weight:" << endl;
cin >> weight2;
bmi1 = getBMI(height1, weight1, scalar);
bmi2 = getBMI(height2, weight2, scalar);
cout << "out 1: " << bmi1 << endl;
cout << "out 2: " << bmi2 << endl;
output(bmi1);
output(bmi2);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment