BMI = 703 * weight(lb)/(height)^2(in)
The National Institutes of Health (NIH) lists the following categories of BMI values:
Underweight = <18.5
Normal weight = 18.5-24.9
Overweight = 25-29.9
Obesity = BMI of 30 or greater
Create a program which reads a file called persons.txt. This text file contains a series of records (one per line) each of which has three values separated by spaces (name, height in inches, and weight in pounds). Once the file is read, your program should report the name BMI value, and NIH classification for each individual to a file called bmi.txt.
To assist in your processing, create a struct called Person that stores the record data for one individual. As each record is read from the file, create a variable of struct Person and populate it with the three data values of the record. Finally, store that variable into an array of Person.
A sample input file of four records might look like so
Homer 72 200
Marge 65 120
Bart 48 75
Lisa 45 60
ask the user for the size and weight
ex.
lisa is 45 tall
weighs 60lbs
Chris C
Please put some code together that is an attempt to perform this operation.
Then come back and ask for help as to where there are problems.
Or at least attempt to show the work you did, and then ask us to fix it.
You will learn an immense amount more than you would if someone else did it for you.
Orignal From: HUSE FILES AND STRINGS TO MAKE THIS PROGRAM?
No comments:
Post a Comment