Question: For the Problem 3 that you have accomplished in Assignment 1 , you will group all variables, including array variables into a struct to practice
For the Problem that you have accomplished in Assignment you will group all variables, including array variables into a struct to practice grouping variables. So you will basically go ahead and copy the code that you have done from Assignment and replace variable name with struct and initialize the struct via objects and ensure that the whole program flow reflects the struct access.
Problem :
#include
#include
using namespace std;
int main
Declare variables
string name, gender;
int age, heightFeet, heightInches;
double weightInPounds;
Ask the user to enter their information
cout "Please enter your name: ;
getlinecin name;
cout "Please enter your age: ;
cin age;
cout "Please enter your Gender malefemale: ;
cin.ignore;
getlinecin gender;
cout "Please enter your height in feet: ;
cin heightFeet;
cout "Please enter your height in inches: ;
cin heightInches;
cout "Please enter your weight in pounds: ;
cin weightInPounds;
Calculate BMI
int heightInInches heightFeet heightInches;
double bmi weightInPoundsheightInInches heightInInches;
Determine BMI category
string bmiCategory;
if bmi
bmiCategory "Severe Thinness";
else if bmi
bmiCategory "Moderate Thinness";
else if bmi
bmiCategory "Mild Thinness";
else if bmi
bmiCategory "Normal";
else if bmi
bmiCategory "Overweight";
else if bmi
bmiCategory "Obese Class I";
else if bmi
bmiCategory "Obese Class II;
else
bmiCategory "Obese Class III";
Output user information and BMI category
cout
Hi name endl;
cout "You are a gender You are age years old." endl;
cout "You are currently heightFeet heightInches and you currently weigh weightInPounds pounds." endl;
cout "Your BMI is bmi which is bmiCategory endl;
cout
Thank you for using the BMI Calculator!" endl;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
