0

Hey! so my teacher is forgin, as i am and i'm having trouble understanding what he says... here is an assignment i got and im not sure what exactly it's asking. Would be big help if any of you guys could figure out what the question is wanting me to do.

1. Declare an enumeration type consisting of the nine planets in their order by distance from the Sun (Mercury first, Pluto last).
2. Write a value-returning function that converts the name of a planet of the enumeration type declared in Step 1 into the corresponding string. The planet is an input parameter and the string is returned by the function. If the input is not a valid planet, return “Error”.
3. Write the main function with a For statement that prints out the names of the planets in order, using the enumeration type declared in Step 1 and the function declared in Step 2.

4
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by thines01
0

Seems fairly straightforward. Don't bother with numbers 2 or 3 till you understand number 1, which you apparently don't, so you need to take a basic tutorial on enumerated types. It's just this.

enum Planet {MERCURY, VENUS, EARTH, MARS, JUPITER, SATURN, URANUS, NEPTUNE, PLUTO};
0

That question is very clear. You're to write a function that converts enumeration values into their corresponding string (ie. MERCURY into "Mercury" given enum planets { MERCURY }; ) and a driver that tests the function.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.