forked from Codecademy/learn-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
space.cpp
48 lines (27 loc) · 780 Bytes
/
space.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
int main() {
double weight;
int x;
std::cout << "Please enter your current earth weight: ";
std::cin >> weight;
std::cout << "\nI have information for the following planets:\n\n";
std::cout << " 1. Venus 2. Mars 3. Jupiter\n";
std::cout << " 4. Saturn 5. Uranus 6. Neptune\n\n";
std::cout << "Which planet are you visiting? ";
std::cin >> x;
if (x == 1) {
weight = weight * 0.78;
} else if (x == 2) {
weight = weight * 0.39;
} else if (x == 3) {
weight = weight * 2.65;
} else if (x == 4) {
weight = weight * 1.17;
} else if (x == 5) {
weight = weight * 1.05;
} else if (x == 6) {
weight = weight * 1.23;
}
std::cout << "\nYour weight: " << weight << "\n";
return 0;
}