Advertisement
marcusziade

space mma app

Jan 26th, 2023
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.39 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. enum class Planet {
  4.     Mercury = 1,
  5.     Venus,
  6.     Earth,
  7.     Mars,
  8.     Jupiter,
  9.     Saturn,
  10.     Uranus,
  11.     Neptune
  12. };
  13.  
  14. int main() {
  15.  
  16.   double earth_weight;
  17.   Planet planet_number;
  18.   double competing_weight;
  19.  
  20.   std::cout << "Enter your weight on Earth:\n";
  21.   std::cin >> earth_weight;
  22.  
  23.   std::cout << "Which planet in our solar system do you want to fight on?\n";
  24.   std::cout << "1: Mercury\n2: Venus\n3: Mars\n4: Jupiter\n5: Saturn\n6: Uranus\n7: Neptune\n";
  25.   std::cin >> planet_number;
  26.  
  27. switch (planet_number) {
  28.   case Planet::Mercury:
  29.       competing_weight = earth_weight * 0.38;
  30.       break;
  31.  
  32.   case Planet::Venus:
  33.       competing_weight = earth_weight * 0.91;
  34.       break;
  35.  
  36.   case Planet::Earth:
  37.       competing_weight = earth_weight * 1.0;
  38.       break;
  39.  
  40.   case Planet::Mars:
  41.       competing_weight = earth_weight * 0.38;
  42.       break;
  43.  
  44.   case Planet::Jupiter:
  45.       competing_weight = earth_weight * 2.34;
  46.       break;
  47.  
  48.   case Planet::Saturn:
  49.       competing_weight = earth_weight * 1.06;
  50.       break;
  51.  
  52.   case Planet::Uranus:
  53.       competing_weight = earth_weight * 0.92;
  54.       break;
  55.  
  56.   case Planet::Neptune:
  57.       competing_weight = earth_weight * 1.19;
  58.       break;
  59.  
  60.   default:
  61.       std::cout << "Pick one of the seven options";
  62.       break;
  63.   }
  64.  
  65.   std::cout << "Your competing weight is " << competing_weight << " kg.";
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement