Skip to content

Instantly share code, notes, and snippets.

@jakeywunder
Created August 5, 2020 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakeywunder/20ad25d778f9c0ae6e61da6ed842a1e2 to your computer and use it in GitHub Desktop.
Save jakeywunder/20ad25d778f9c0ae6e61da6ed842a1e2 to your computer and use it in GitHub Desktop.
#include <iostream>
int main() {
double earthweight;
int planet;
std::cout << "Hello, Little Mac! What is your earth weight, little interplanetary space boxer? Lets say in pounds, shall we?\n";
// taking input from user and putting it into earthweight
std::cin >> earthweight;
std::cout << "\nExcellent! Now what planet would you like to fight on? \n1 for Venus or \n2 for Mars or \n3 for Jupiter or \n4 for Saturn or \n5 for Uranus!!\n\n Choose wisely, for your weight will vary greatly, young space boxer.\n";
//taking input from user and putting it into planet
std::cin >> planet;
//disallowing improper input
while (planet > 5 || planet < 1) {
std::cout << "I'm sorry but the number " << planet << " is not an option! Try again and remember, it's just 1-5!\nWhich planet would you like to fight on?\n1 is Venus, 2 is Mars, 3 is Jupiter, 4 is Saturn, and 5 is Uranus.\nWhich planet: ";
std::cin >> planet;
}
//defining Little Mac's weight in each planet variable
double venusweight = (earthweight * 0.78);
double marsweight = (earthweight * 0.39);
double jupiterweight = (earthweight * 2.65);
double saturnweight = (earthweight * 1.17);
double uranusweight = (earthweight * 1.05);
switch (planet) {
case 1:
std::cout << "\nCongratulations, little one! On Venus, you'll weigh " << venusweight << " pounds! Time to pull out those speedos!\n";
break;
case 2:
std::cout << "\nA toasty choice! On Mars, you'll weigh " << marsweight << " pounds! Throw that diet out the window!\n";
break;
case 3:
std::cout << "\nOof! Looks like you're going to be weighing " << jupiterweight << " pounds on Jupiter! Best leave those oreos in the cupboard for a few weeks and break out the cellery!\n";
break;
case 4:
std::cout << "\nOkay okay! You'll be weighing " << saturnweight << " pounds. Not too bad but maybe don't finish that whole chip, and don't forget to put a ring on it!\n";
break;
case 5:
std::cout << "\nWell you're in luck, little space boxer, because on Uranus you'll be weighing " << uranusweight << " pounds, which is almost identical to your current weight! \n";
break;
default:
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment