Advertisement
arcadiansnow

Untitled

Feb 14th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. #include <iostream>
  2. #include<cmath>
  3. #include<cstdlib>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. double LBS, KG, NKG;
  10. double M, D, R, G, g, Eg, Cg, SoL, SoS, SoLD, SoSD;
  11. int planetNumber
  12. //int Mercury, Venus, Moon, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto, Sun;
  13.  
  14. // Mercury = 1;
  15. // Venus = 2;
  16. // Moon = 3;
  17. // Mars = 4;
  18. // Jupiter = 5;
  19. // Saturn = 6;
  20. // Uranus = 7;
  21. // Neptune = 8;
  22. // Pluto = 9;
  23. // Sun = 0;
  24.  
  25. cout << "Please enter your current weight on earth in pounds";
  26. cin>>LBS;
  27.  
  28. double const G = 6.674*pow(10.0, -11);
  29. double const Eg = 9.81;
  30. double const SoL = 6.71*pow(10.0, 8);
  31. double const SoS = 761;
  32.  
  33. cout << "Enter a number for a celestial body from the list below" << "Mercury is 1" << "Venus is 2" << "The Moon is 3" << "Mars is 4" << "Jupiter is 5" << "Saturn is 6" << "Uranus is 7" << "Neptune is 8" << "Pluto is 9" << "The Sun is 10" << endl;
  34. cin >> planetNumber;
  35.  
  36. if (planetNumber == 1)
  37. {
  38. M = 3.30*pow(10.0, 23);
  39. D = 48;
  40. R = 2440;
  41. }
  42. else if (planetNumber == 2)
  43. {
  44. M = 4.87*pow(10.0, 24);
  45. D = 28;
  46. R = 6051.8;
  47. }
  48. else if (planetNumber == 3)
  49. {
  50. M = 7.35*pow(10.0, 22);
  51. D = 0.226;
  52. R = 1738;
  53. }
  54. else if (planetNumber == 4)
  55. {
  56. M = 6.42*pow(10.0, 23);
  57. D = 34;
  58. R = 3397;
  59. }
  60. else if (planetNumber == 5)
  61. {
  62. M = 1.90*pow(10.0, 27);
  63. D = 346;
  64. R = 71492;
  65. }
  66. else if (planetNumber == 6)
  67. {
  68. M = 5.68*pow(10.0, 26);
  69. D = 746;
  70. R = 60268;
  71. }
  72. else if (planetNumber == 7)
  73. {
  74. M = 8.68*pow(10.0, 25);
  75. D = 1600;
  76. R = 25559;
  77. }
  78. else if (planetNumber == 8)
  79. {
  80. M = 1.02*pow(10.0, 26);
  81. D = 2700;
  82. R = 24766;
  83. }
  84. else if (planetNumber == 9)
  85. {
  86. M = 1.27*pow(10.0, 22);
  87. D = 2600;
  88. R = 1137;
  89. }
  90. else if (planetNumber == 10)
  91. {
  92. M = 1.99*pow(10.0, 30);
  93. D = 91;
  94. R = 695000;
  95. }
  96.  
  97. g = G*(M / (R*R));
  98. Cg = g / Eg;
  99. NKG = KG*Cg
  100. SoLD = D / SoL;
  101. SoSD = D / SoS;
  102.  
  103. cout << "This your mass on the selected celestial body:" << NKG << endl;
  104. cout << "This is the time, in hours, it would take to get to your selected celestial body traveling at the speed of light:" << SoLD << endl;
  105. cout << "This is the time, in hours, it would take to get to your selected celestial body traveling at the speed of sound:" << SoSD << endl;
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement