hey ya'll i've made this code (simple, bc that's what i am) and i think it would work except for the tiny problem that i always get the error that the switch statement is illegal, but i don't know what to put instead (when i do run the program, it stops and says that it can't run anymore b/c the statement isn't defined). any helps would be great, thankies..here's the code....
#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
float inWeight;
float inPlanet;
int planet;
cout << "Enter you weight.\n";
cin >> inWeight;
cout << "Press 1 for Mercury\n";
cout << "2 for Venus\n";
cout << "3 for Earth\n";
cout << "4 for Moon\n";
cout << "5 for Mars\n";
cout << "6 for Jupiter\n";
cout << "7 for Saturn\n";
cout << "8 for Uranus\n";
cout << "9 for Neptune\n";
cout << "10 for Pluto\n";
cin >> inPlanet;
switch (planet)
{
case 1: cout << (inWeight * 0.4155);
break;
case 2: cout << (inWeight * 0.8975);
break;
case 3: cout << (inWeight * 1.0);
break;
case 4: cout << (inWeight * 0.166);
break;
case 5: cout << (inWeight * 0.3507);
break;
case 6: cout << (inWeight * 2.5374);
break;
case 7: cout << (inWeight * 1.0677);
break;
case 8: cout << (inWeight * 0.8947);
break;
case 9: cout << (inWeight * 1.1794);
break;
case 10: cout << (inWeight * 0.0899);
break;
default : cout << "Not a planet.";
}
return 0;
}