enumerated data type as a menu item selection

My otherwise detailed assignment prompt has a sentence in the middle reading

"Use an enumerated data type for the menu item selection"

The trouble is I can't figure out how to take user input as enumerated data.
I pictured it something like

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
enum menu
{
  FIRST
  SECOND
  THIRD
};

menu choice;

cin >> choice;

if (choice==FIRST)
cout << "You've chosen first";
else if (choice==SECOND)
cout << "You've chosen second";
else if (choice==THIRD)
cout << "You've chosen third";


This is rough obviously, but I thought the idea was simple enough, though I failed to realize you can't simply throw any data type into an enumeration, and this failure has me doubting what the assignment is actually asking me to do.

I assumed it is asking for a string, and will compare that to the menu options, which I could just as easily do without the use of enumerations at all. Also, I know that I can simply check the input, assign an int, and check that int against the enumerations, but again this leaves me wondering whats the point of using enum in the first place?

Is this just a superfluous test to see if I can shoehorn needless enumerations into a program, or is there something I'm missing? Please help.
Honestly, I'm kind of suspecting that it probably is as you think, since you can't read an enumeration directly from the user directly via cin. You can, however, read an integer and cast that to the enumeration's type; just make sure to specify what integers correspond to which value in the enumeration.
If a value is not specified for the first enumerated value it is automatically 0 (value... value... how do you call a single element of an enum?)
Topic archived. No new replies allowed.