Why won't this program work?

Nevermind, I finally figured it out. As usual it was a little silly mistake. I forgot to finish converting the mass into meters. Don't know why I didn't catch that.

Ok, so I'm trying to create a program that calculates your BMI, but I can't seem to get it to give the right output. I've made this program once before and decided to go back through this book to see if I remembered everything. I can't get this to give me the right output. It's probably some silly mistake, but I haven't been able to find it.
[code]#include "stdafx.h"

#include <iostream>

int main()
{
using std::cout;
using std::cin;
const int toinches = 12; // Multiply
const float tometers = .0254f; // multiply
const float tokilograms = 2.2f; // divide
int feet;
int inches;
int mass;
cout << "Please enter your height in feet and inches (separate with space): \n_ _\b\b\b";
cin >> feet >> inches;
cout << "Now enter your weight in pounds: ___\b\b\b";
cin >> mass;
//BMI = divide mass in kilograms by the square of height in meters
mass = mass / tokilograms;
inches = feet * toinches + inches;
double BMI = mass/ (inches * inches);
cout << "Your BMI is: " << BMI << "\n";
return 0;
}
[/code]
Last edited on
Topic archived. No new replies allowed.