Hi there,
I'm fairly new at this, and I am having a bit of trouble wrapping my head around some concepts of enum for a project. So any help would be greatly appreciated.
Essentially I'm writing a program where i will have an enum in one of my classes. When the program is used, the user will define what actually goes inside the enum.
So for example what I mean is if the class is WorkDay....and the user defines what days of the weeks he or she works. One user would say monday, tuesday and thursday...and the class would look like:
class WorkDay{
enum days { monday, tuesday, thursday };
}
Another user might say monday, wednesday, thursday and friday....and the class would look like:
class WorkDay{
enum days { monday, wednesday, thursday, friday};
}
My question is....well....how do I actually code that?
How do I define what goes inside the enum each time the program is run through the user's input??
Another question is....how do I assign the enum constants to variables when it's inside a class?
Do I use something like:
WorkDay enum today = sunday; //???
And one final question....how do I actually output the enum constant?
If I want to output the above variable 'today'...it has already been enumerated...so it would output an number. But what if I want to output the word 'sunday' instead?
Sorry to bombard everyone with all of these questions. I'm just really confused with the basic concepts right now.
Thanks a lot for your help.