Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- enum class Planet {
- Mercury = 1,
- Venus,
- Earth,
- Mars,
- Jupiter,
- Saturn,
- Uranus,
- Neptune
- };
- int main() {
- double earth_weight;
- Planet planet_number;
- double competing_weight;
- std::cout << "Enter your weight on Earth:\n";
- std::cin >> earth_weight;
- std::cout << "Which planet in our solar system do you want to fight on?\n";
- std::cout << "1: Mercury\n2: Venus\n3: Mars\n4: Jupiter\n5: Saturn\n6: Uranus\n7: Neptune\n";
- std::cin >> planet_number;
- switch (planet_number) {
- case Planet::Mercury:
- competing_weight = earth_weight * 0.38;
- break;
- case Planet::Venus:
- competing_weight = earth_weight * 0.91;
- break;
- case Planet::Earth:
- competing_weight = earth_weight * 1.0;
- break;
- case Planet::Mars:
- competing_weight = earth_weight * 0.38;
- break;
- case Planet::Jupiter:
- competing_weight = earth_weight * 2.34;
- break;
- case Planet::Saturn:
- competing_weight = earth_weight * 1.06;
- break;
- case Planet::Uranus:
- competing_weight = earth_weight * 0.92;
- break;
- case Planet::Neptune:
- competing_weight = earth_weight * 1.19;
- break;
- default:
- std::cout << "Pick one of the seven options";
- break;
- }
- std::cout << "Your competing weight is " << competing_weight << " kg.";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement