Need help understanding my errors

/*
Write a program that will determine the user’s weight in other locations in our solar system.
The program should :

Ask the user to enter the weight(on earth).Store the weight in a double variable.
Present a menu of locations in our solar system, assigning numbers to each.
Get the user input as an integer.
Use a switch statement to calculate the weight on the chosen planet.Use the conversion factors
in the table below to determine the user’s weight on the chosen planet.
*/

#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

int main()
{
double weight;
int milky;

cout << "What is your weight (in pounds)? /n" << endl;
cin >> weight;

cout << "Enter the part of the solar system in which you'd like to see your weight. /n" << endl;
cout << "For Outer Space enter "0": /n" << endl;
cout << "For Mercury enter "1": /n" << endl;
cout << "For Venus enter "2": /n" << endl;
cout << "For Mars enter "3": /n" << endl;
cout << "For Jupiter enter "4": /n" << endl;
cout << "For Saturn enter "5": /n" << endl;
cout << "For Uranas enter "6": /n" << endl;
cout << "For Neptune enter "7": /n" << endl;
cout << "For Pluto enter "8": /n" << endl;
cin >> milky;

switch (milky)
{
case (0):
cout << "Your weight in outer space is: /n" << (weight * 0) << endl;
break;
case (1):
cout << "Your weight on Mercury is: /n" << (weight * 0.38) << endl;
break;
case (2):
cout << "Your weight on Venus is: /n" << (weight * 0.90) << endl;
break;
case (3):
cout << "Your weight on Mars is: /n" << (weight * 0.38) << endl;
break;
case (4):
cout << "Your weight on Jupiter is: /n" << (weight * 2.36) << endl;
break;
case (5):
cout << "Your weight on Saturn is: /n" << (weight * 0.92) << endl;
break;
case (6):
cout << "Your weight on Uranas is: /n" << (weight * 0.89) << endl;
break;
case (7):
cout << "Your weight on Neptune is: /n" << (weight * 1.13) << endl;
break;
case (8):
cout << "Your weight on Pluto is: /n" << (weight * 0.07) << endl;
break;
if (milky < 0 || milky > 8)
{
cout << "Please input a number 0-8 to use this program.";
}
}

return 0;

}
 
cout << "What is your weight (in pounds)? /n" << endl;

"\n" for a new line.
Why do you use "\n" and then endl ?
I'd recommend you use "\n" over endl.

case (0):
You don't need the parentheses around the 0.

1
2
3
4
if (milky < 0 || milky > 8)
{
    cout << "Please input a number 0-8 to use this program.";
}

This is what the default case is for.
Topic archived. No new replies allowed.