Advertisement
ItzEdInYourBed

Untitled

May 15th, 2020
1,722
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.15 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int main() {
  4.   double weight;
  5.   string planet;
  6.   std::cout << "What is your earth weight? (lbs)\n";
  7.   std::cin >> weight;
  8.   std::cout << "Please choose a planet below\n";
  9.   std::cout << "1. Venus\n";
  10.   std::cout << "2. Mars\n";
  11.   std::cout << "3. Jupiter\n";
  12.   std::cout << "4. Saturn\n";
  13.   std::cout << "5. Uranus\n";
  14.   std::cout << "6. Neptune\n";
  15.   std::cout << "Note: Choose number only\n"
  16.   std::cin >> planet;
  17.  
  18.   if (planet == 1){
  19.       weight = weight * 0.78; //venus gravity 0.78
  20.       planet = "Venus"
  21.     }else if (planet == 2){
  22.       weight = weight * 0.39; //mars gravity 0.39
  23.       planet = "Mars"
  24.     }else if (planet == 3){
  25.       weight = weight * 2.65; //jupiter gravity 2.65
  26.       planet = "Jupiter"
  27.     }else if (planet == 4){
  28.       weight = weight * 1.17; //saturn gravity 1.17
  29.       planet = "Saturn"
  30.     }else if (planet == 5){
  31.       weight = weight * 1.05; //uranus gravity 1.05
  32.       planet = "Uranus"
  33.     }else if (planet == 6){
  34.       weight = weight * 1.23; //neptune gravity 1.23
  35.       planet = "Neptune"
  36.     }
  37.   std::cout << "Your weight on " << planet << " is " << weight << "lbs.\n";
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement