Project 1 - Body-mass index
Project 1 - Body-Mass Index

This program is Project 1 in Exploring C++, by Ray Lischner (Apress).

Your task is to write a program that reads records, prints the records, and computes some statistics. The program starts by asking for a threshold BMI. Only records with a BMI greater than or equal to the threshold will be printed. Each record consists of a person's name (which might contain spaces), weight in kilograms, height in centimeters (not meters), and the person's sex ('M' or 'F'). Let the user enter the sex in uppercase or lowercase.

Print each person's BMI after reading that person's record. After collecting information for everyone, print two tables of the information. One table is for men and the other is for women. Mark records for which the BMI meets or exceeds the threshold with an asterisk after the BMI. After each table, print the mean (average) and median BMI. (Median is the value such that half the BMI values are less than the median and half are greater than the median. If the user enters an even number of records, take the average of the two values in the middle.) Compute individual BMI values as integers. Compute the mean and median BMIs as floating point numbers, and print the mean with one place after the decimal point.

Body-mass index is defined as weight in kg/(height in m)2, converted to a unitless number.

Source file: bmi.cpp

Author
Ray Lischner