-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspace.cpp
More file actions
27 lines (24 loc) · 797 Bytes
/
space.cpp
File metadata and controls
27 lines (24 loc) · 797 Bytes
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
"Developer: Hosna Hamdieh"
"Practicing condidtions using case"
#include <iostream>
int main() {
double weight;
std::cout<<"Enter your earth weight: ";
std::cin>>weight;
int planet;
double RG;
std::cout<<"Enter a number for the planet you want:\n1: Mercury, 2: Venus, 3: Mars, \n4: Jupiter, 6: Saturn 6: Uranus, 7: Neptune \nSelected planet: ";
std::cin>>planet;
switch (planet) {
case 1: RG = 0.38;break;
case 2: RG = 0.91;break;
case 3: RG = 0.38;break;
case 4: RG = 2.34;break;
case 5: RG = 1.06;break;
case 6: RG = 0.92;break;
case 7: RG = 1.19;break;
default: RG = 1;break;
}
double calculated_weight = weight * RG;
std::cout<<"Your wieght in the chosen planet("<<planet<<") is "<<calculated_weight<<"\n";
}