Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<cmath>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- double LBS, KG, NKG;
- double M, D, R, G, g, Eg, Cg, SoL, SoS, SoLD, SoSD;
- int planetNumber
- //int Mercury, Venus, Moon, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto, Sun;
- // Mercury = 1;
- // Venus = 2;
- // Moon = 3;
- // Mars = 4;
- // Jupiter = 5;
- // Saturn = 6;
- // Uranus = 7;
- // Neptune = 8;
- // Pluto = 9;
- // Sun = 0;
- cout << "Please enter your current weight on earth in pounds";
- cin>>LBS;
- double const G = 6.674*pow(10.0, -11);
- double const Eg = 9.81;
- double const SoL = 6.71*pow(10.0, 8);
- double const SoS = 761;
- 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;
- cin >> planetNumber;
- if (planetNumber == 1)
- {
- M = 3.30*pow(10.0, 23);
- D = 48;
- R = 2440;
- }
- else if (planetNumber == 2)
- {
- M = 4.87*pow(10.0, 24);
- D = 28;
- R = 6051.8;
- }
- else if (planetNumber == 3)
- {
- M = 7.35*pow(10.0, 22);
- D = 0.226;
- R = 1738;
- }
- else if (planetNumber == 4)
- {
- M = 6.42*pow(10.0, 23);
- D = 34;
- R = 3397;
- }
- else if (planetNumber == 5)
- {
- M = 1.90*pow(10.0, 27);
- D = 346;
- R = 71492;
- }
- else if (planetNumber == 6)
- {
- M = 5.68*pow(10.0, 26);
- D = 746;
- R = 60268;
- }
- else if (planetNumber == 7)
- {
- M = 8.68*pow(10.0, 25);
- D = 1600;
- R = 25559;
- }
- else if (planetNumber == 8)
- {
- M = 1.02*pow(10.0, 26);
- D = 2700;
- R = 24766;
- }
- else if (planetNumber == 9)
- {
- M = 1.27*pow(10.0, 22);
- D = 2600;
- R = 1137;
- }
- else if (planetNumber == 10)
- {
- M = 1.99*pow(10.0, 30);
- D = 91;
- R = 695000;
- }
- g = G*(M / (R*R));
- Cg = g / Eg;
- NKG = KG*Cg
- SoLD = D / SoL;
- SoSD = D / SoS;
- cout << "This your mass on the selected celestial body:" << NKG << endl;
- 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;
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement