logo CodeStepByStep logo

BMI

Related Links:

Write a complete C++ program with a main function to calculate 2 people's body mass index (BMI), using the following formula:

BMI = weight / height2 * 703

The BMI rating groups each person into one of the following four categories:

BMI Category
below 18.5 class 1
18.5 - 24.9 class 2
25.0 - 29.9 class 3
30.0 and up class 4

Match the following example output:

This program reads data for two people
and computes their body mass index (BMI).

Enter Person 1's information:
height (in inches)? 70.0
weight (in pounds)? 194.25
BMI = 27.8689, class 3

Enter Person 2's information:
height (in inches)? 62.5
weight (in pounds)? 130.5
BMI = 23.4858, class 2

BMI difference = 4.3831

You should break down your program into several functions, each of which helps solve the overall problem.

Complete program: Write an entire program that you could put into a file and run outside of CodeStepByStep.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.