I have a basic enum
declaration:
enum Title {Prof, Dr, Mr, Mdm, Mrs, Miss, NA};
I\'m trying to map the user input(0,1,2,3,4,5,AnyN
An enum
does not really store a series of characters as you seem to think, it just provides new names for some values of the underlying type (in your case, int
). (This is somewhat simplified of course, but good enough to explain the observed behavior.)
Thus, printing an enum
-element does not print its "name", but will result in the element being converted to the underlying type and then printed.