i need to write a function called bmiCalculator, which calculate based on:
a) the function is to be passed the weight n height as parameters. the weight and height in pounds and feet, respectively.
b) the function should convert pounds to kilograms (0.454kilograms per pound) and feet to meters (0.3046 meters per foot).
c) function should calculate and return bmi value using algebric formula

bmi= weight in kilograms / (height in meters)2

the function prototype is : float bmiCalculator(float lbs,float ft);

----------------------------------------------------

Here are what i've done..plz check :

``````// Test 1/MAR 2006
// A function bmiCalculator is to calculate the body mass index (bmi)

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
int pounds;
int feet;
float lbs;
float ft;

cout << " " << endl;
cout << "*** Program to calculate body mass index ***" << endl;
cout << "--------------------------------------------" << endl;
cout << " " << endl;
cout << "Enter your weight in pounds"<< endl;
cin >> pounds;

cout << "Enter your height in feet"<< endl;
cin >> feet;

lbs = (pounds * 0.454);
cout << "Your weight in kilograms is "<< lbs << endl;

ft = (feet * 0.3046);
cout <<"Your height in meter is "<< ft << endl;

float bmiCalculator;

bmiCalculator = (lbs/(ft*ft));
cout << "Your body mass index (bmi) is "<< bmiCalculator << endl;
return 0;
}
``````

hope this can help.

``````float bmiCalculator(float lbs,float ft) {
return ((lbs * .454) /(ft * ft * .3046  * .3046 )) ;
}
``````
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.