Professional Documents
Culture Documents
h"
#include <iostream>
#include <fstream>
#include <string>
int main()
{
float weight;
float height;
string Weight;
cout << "Please eneter your weight (Kg)" << "\n"; // this will ask the
user to input their weight in kilograms
cin >> weight; // user inputs their weight in kilograms
cout << "Please enter your height (m)" << "\n"; // this will ask the
user to input their height in meters
cin >> height; // user inputs their height in meters
int bmi = weight / (height * height); // this will calculate the users BMI
if (bmi > 0 && bmi <= 15) { // if the BMI is between 0 to 15 it will
display the following message
else if (bmi > 16 && bmi <= 17) { // if the BMI is 16 / 17 it will dispay
the following message
else if (bmi > 18 && bmi <= 23) { // if the BMI is between 18 to 23 it will
dispay the following message
else if (bmi > 24 && bmi <= 28) { // if the BMI is between 24 to 28 it will
dispay the following message
else if (bmi > 29 && bmi <= 34) { // if the BMI is between 29 to 34 it will
dispay the following message
cout << "You are seriously overweight";
Weight = "You are seriously overweight";
}
else {
cout << "You are gravely overweight"; // if the BMI is over 34 it will
display this message
Weight = "You are gravely overweight";
}
ifstream MyReadFile("filename2.txt");
MyReadFile.close();