Question: I need to convert this Python program into a C++ program. # List of categories. category = ['under weight', 'normal', 'over weight', 'obesity','Seriously obese'] #
I need to convert this Python program into a C++ program.
# List of categories. category = ['under weight', 'normal', 'over weight', 'obesity','Seriously obese']
# Ask for values weight = float(input('Please enter your weight in kg : ')) height = float(input('Please enter your height in cm : '))
# convert height to meters height = height/100 # calculate bmi value bmi = weight / (height * height)
if bmi < 18.5: weight_class = category[0] elif bmi < 24.9: weight_class = category[1] elif bmi < 29.9: weight_class = category[2] elif bmi<34.9: weight_class = category[3] else: weight_class=category[4]
# Output print('Your BMI is', bmi, ' and weight class is: ', weight_class)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
