Something Wrong with Program

I started coding a program and the first function I'm coding is supposed to get a weight factor from the user and use that factor to return the planet (planets enum type) with that factor.I created a small driver program to test the function and I'm getting a strange error. Can someone tell me whats wrong with the code.

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

using namespace std;
enum Planet{Mercury,Venus,Earth,Moon,Mars,Jupiter,Saturn,Uranus,Neputun,Pluto}

int main()
{
GetPlanet(.4155); //this is the weight factor from user.

return 0;
}


void GetPlanet(double factor)
{
switch(factor)
{
case .4155: return Mercury;
break;
case .8975: return Venus
break;
case 1.0: return Earth;
break;
case .3507: return Mars;
break;
case 2.5374: return Jupiter;
break;
case 1.0677: return Saturn;
break;
case 0.8947: return Uranus;
break;
case 1.1794: return Neptune;
break;
case .0899: return Pluto;
break;
}


}
You can only switch on integer types (you can't use double.)
Thank you I fixed it to all if else statements instead of using the switch statement even though that was exceedingly tedious. XD
Topic archived. No new replies allowed.