I am quite new to c++ and programming in general. In my program, I am attempting to calculate the weight of an object on other planets by asking the user for a earth weight and then the planet they want to compare the earth weight with. Using switch(planetnumber), I was hoping that based on the number they picked(1-6) the program would define the variable otherweight based on the case selected. I ran into a error: "lvalue required as left operand of assignment weight * 0.78 = otherweight;" This did not work the way it was intended, could anyone point me in the right direction?
#include <iostream>
int main()
{
double weight;
int planetnumber;
double otherweight;
std::cout << "Enter weight\n";
std::cin >> weight;
std::cout << "Please select your arena\n";
std::cin >> planetnumber;
switch (planetnumber)
{
case 1:
weight * 0.78 = otherweight;
break;
case 2:
weight * 0.39 = otherweight;
break;
case 3:
weight * 2.65 == otherweight;
break;
case 4:
weight * 1.17 = otherweight;
break;
case 5:
weight * 1.05 = otherweight;
break;
case 6:
weight * 1.23 = otherweight;
break;
default:
std::cout << "Not a valid input\n";
break;
}
std::cout << "your weight is " << otherweight << std::endl;
}