Im having some trouble with a program. This program is supposed asks the user to enter name/or id of a planet and his/her weight. The program then outputs how much the user would weigh on that planet.
I know whats wrong with the code but I don't know how to change it so that it completes the task. The problem I having is that the output is a float but in a switch case statement the error I'm getting says it has to be a integral value. What can I do? here is the code
int main()
{
int weight;
string name;
int planet;
cout<<"Hello. Please enter your name:"<<endl;
cin>> name;
cout<<"Thank you. Now please enter your weight in pounds:"<<endl;
cin>> weight;
cout<<"Enter the number of the planet to find out how muchou weight on that planet,"<<endl;
cout<< "1:Mercury 2.Venus 3.Earth 4.Moon 5. Mars 6. Jupiter 7. Saturn 8.Uranus. 9.Neputun 10.Pluto "<<endl;
cin>>planet;
switch(planet)
{
case 1: weight= (weight*.4155);
cout<<"Your wieght on that planet is "+ weight+'.'<<endl;//says the weight has to be int value
break;
case 2: weight=(weight*.8975);
cout<<"Your wieght on that planet is "+ weight+'.'<<endl;
break;
case 3: weight=(weight*1.0);
cout<<"Your wieght on that planet is "+ weight+'.'<<endl;
break;
case 4: weight=(weight*.166);
cout<<"Your wieght on that planet is "+ weight+'.'<<endl;
break;
case 5: weight=(weight*.3507);
cout<<"Your wieght on that planet is "+ weight+'.'<<endl;
break;
case 6: weight=(weight*2.5374);
cout<<"Your wieght on that planet is "+ weight+'.'<<endl;
break;
case 7: weight=(weight*1.0677);
cout<<"Your wieght on that planet is "+ weight+'.'<<endl;
break;
case 8: weight=(weight*.8947);
cout<<"Your wieght on that planet is "+ weight+'.'<<endl;
break;
case 9: weight=(weight*1.1794);
cout<<"Your wieght on that planet is "+ weight+'.'<<endl;
break;
case 10: weight=(weight*.0899);
cout<<"Your wieght on that planet is "+ weight+'.'<<endl;
break;
default: cout<< "Number is not on the list"<<endl;
break;
}