| Lexington High School Mathematics | Math Dept. Front Page | Student Links | Family Links |
| Introduction to C++, Kevin Kelly | Kelly Front Page | C++ Course Guide | C++ Assignments | C++ Info |
Write a function
float BodyMassIndex(int inches, int lbs);that takes a person's height in inches and weight in pounds as arguments and returns the body mass index (BMI).
The BMI is defined as the weight, expressed in kilograms, divided by the square of the height expressed in meters. One inch is 0.0254 meters and one pound is 0.454 kilograms.
Write a program that prompts for a weight
and height, calls BodyMassIndex, and displays the BMI.
Test the program using realistic height-weight combinations
for three different people.
Original source of this problem: Litvin and Litvin, "C++ for You" workbook, page 20.