"No operator matches these operands" Why I am getting this error message?
I’m make switch system that alterations the inputted weight according to what planet the consumers choose.This system gives the particular error message next time i put cin for that enum changing I made.Here’s this system:
#include
utilizing namespace a sexually transmitted disease;
int main()
enum planetMercury, Venus, Earth, Moon, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto;
world thisPlanet;
float weight;
cout << "please enter excess fat in pounds" << endl;
cin >> bodyweight;
cout << "enter selection for environment:0 = Mercury, Venus = A SINGLE, Earth = ONLY TWO, Moon = THREE, Mars = SOME, Jupiter = 5 VARIOUS, Saturn = A FEW, Uranus = SEVEN, Neptune = 8-10, Pluto = 9";
cin >> thisPlanet >> endl;
switch(thisPlanet)
instance Mercury:cout << "Your bodyweight on Mercury is" << weight*0.4155; split;
instance Venus:cout << "Your bodyweight on Venus is" << weight*0.8975; split;
instance Earth:cout << "Your weight we know is" << weight*1; split;
instance Moon:cout << "Your weight for the moon is" << weight*0.166; split;
instance Mars:cout << "Your bodyweight on Mars is" << weight*0.3507; split;
instance Jupiter:cout << "Your bodyweight on Jupiter is" << weight*2.5374; split;
instance Saturn:cout << "Your bodyweight on Saturn is" << weight*1.0677; split;
instance Uranus:cout << "Your bodyweight on Uranus is" << weight*0.8974; split;
instance Neptune:cout << "Your bodyweight on Neptune is" << weight*1.1794; split;
instance Pluto:cout << "Your bodyweight on Pluto is" << weight*0.0899; split;
thank you
Try defining an integer in addition to using cin for getting that.In that case, on a different line, try asting the actual integer into the enum.My business is guessing these, but I do believe the proble relates to that.
int when i; cin >>i; thisPlanet = (planet)i;
Leave a Reply
You must be logged in to post a comment.