- Declare an enumeration type consisting of the 8 planets in their order by distance from the
Sun (Mercury first then Sun to the last planet). - Write a value-returning function that converts a planet of the enumeration type declared in
Exercise 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”. - Write a For statement that prints out the names of the planets in order, using the
enumeration type declared in Exercise 1 and the function declared in Exercise 2.
ᴇXᴄᴀLɪʙ
0
Newbie Poster
Recommended Answers
Jump to PostThat's a basic excercise in using enums. https://en.cppreference.com/w/cpp/language/enum
All 2 Replies
Reply to this topic
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.