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.

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};

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.