Last homework problem reads: Write a value-returning function that converts the name of a planet given as a string parameter to a value of the enumeration type declared in exercise 12. If the string isn't a propler planet name, return EARTH.
This is the answer I got for exercise 12: enum Planets {MERCURY, VENUS, EARTH, MARS, JUPITER, SATURN, URANUS, NEPTUNE, PLUTO};
I am still not exactly sure what I must do. Should I use enum? Should I case it? Do I need to create a list of the possible values?
Any tips would be greatly appreciated!
This is the answer I got for exercise 12: enum Planets {MERCURY, VENUS, EARTH, MARS, JUPITER, SATURN, URANUS, NEPTUNE, PLUTO};
I am still not exactly sure what I must do. Should I use enum? Should I case it? Do I need to create a list of the possible values?
Any tips would be greatly appreciated!