Created
August 23, 2016 15:19
-
-
Save livando/207560c9f8cd14f348af7064248d84fe to your computer and use it in GitHub Desktop.
weights.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Manning, Joshua | |
| //CSE 100 | |
| //[email protected] | |
| //HW1_Weights | |
| #include <iostream> | |
| using namespace std; | |
| int main() | |
| { | |
| int mheight_ft, mheight_in, fheight_ft, fheight_in, gender; | |
| cout << "Choose your gender, Enter 0 for male, 1 for female" << endl; | |
| cin >> gender; | |
| //male ideal weight | |
| if (gender = 0) | |
| { | |
| int mheight_total, m_ideal; | |
| cout << "Enter your height in feet, inches and press enter" << endl; | |
| cin >> mheight_ft >> mheight_in; | |
| mheight_total = (mheight_ft * 12) + mheight_in; | |
| //male taller than 60 inches | |
| if (mheight_total <= 60) goto shortguy; | |
| { | |
| m_ideal = 6 * (mheight_total - 60) + 106; | |
| cout << "Your ideal weight is " << m_ideal << " pounds"; | |
| cin.get(); | |
| return 0; | |
| } | |
| //male equal to 60 inches or less: | |
| { | |
| shortguy: | |
| cout << "Your ideal weight is 106 pounds" << endl; | |
| cin.get(); | |
| return 0; | |
| } | |
| } | |
| //female ideal weight | |
| if (gender = 1) | |
| { | |
| int fheight_total, f_ideal; | |
| cout << "Enter your height in feet, inches and press enter" << endl; | |
| cin >> fheight_ft >> fheight_in; | |
| fheight_total = (fheight_ft * 12) + fheight_in; | |
| //female taller than 60 inches | |
| if (fheight_total <= 60) goto shortgal; | |
| { | |
| f_ideal = 5 * (fheight_total - 60) + 100; | |
| cout << "Your ideal weight is " << f_ideal << " pounds"; | |
| //stop bit | |
| cin.get(); | |
| cin.get(); | |
| return 0; | |
| } | |
| shortgal: | |
| cout << "Your ideal weight is 100 lbs" << endl; | |
| //stop bit | |
| cin.get(); | |
| cin.get(); | |
| return 0; | |
| } | |
| //stop bit | |
| cin.get(); | |
| cin.get(); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment