Anyone know why i'm getting the following error?
[C++ Warning] Unit1.cpp(24): W8054 Style of function definition is now obsolete
[Linker Error] Unresolved external 'convert(float, float)' referenced from C:\Program Files\Borland\Cbuilder6\Projects\Project2\Unit1.ob j
I'm sure this code isn't exactly right and theres better ways of writing it... If someone wouldn't mind giving a go at this and helping me understand why there way is better i'd appriciate it For some reason i think i might have added a little to many floats...
using namespace std;
float convert(float, float);
int main(int argc, char* argv)
float height, pounds, BMI;
cout << "Enter your height in feet and inches: ";
cin >> height;
cout << "Enter your weight in pounds: ";
cin >> pounds;
BMI = convert(height, pounds);
cout << "Your Body Mass Index is " << BMI << ".";
float convert(height, pounds)
float inches, meters, kilograms, BMI;
inches = height * 12;
meters = inches * 0.0254;
kilograms = pounds / 2.2;
BMI = kilograms / meters * meters;
Heres the question:
Write a short program that asks for your height in feet and inches, and your weight in pounds. Use three variables to store the information. Have the program report your Body Mass Index. To calculate the BMI, first convert yoru height in feet and inches to your height in inches. Then, convert your height in inches to your height in meters by multiplying by 0.0254. Then, convert your weight in pounds into your mass in kilograms by dividing by 2.2. Finally, compute your BMI by dividing your mass in kilograms by the square of your height in meters. Use symbolic constrants to represent the various conversion factors.