A
Aaron Toponce
Okay, maybe this is a dumb question, but here it goes: Consider the
following code:
enum day_of_week {Mon = 1, Tue, Wed, Thu, Fri, Sat, Sun};
Now, we all know that enums positions are looked at as integers, how would
one go about displaying say "Mon" rather than "1"? For example consider
some more code:
#include <iostream>
#include "stdlib.h"
using namespace std;
enum day_of_week {Mon = 1, Tue, Wed, Thu, Fri, Sat, Sun};
int main()
{
int iChoice;
cout << "Enter a number representing it's corresponding day of the week:
"; cin >> iChoice;
cout << "Your day is " << // what would I type here to access the
corresponding place in day_of_week?
system("PAUSE");
return 0;
}
Thanks for your help
following code:
enum day_of_week {Mon = 1, Tue, Wed, Thu, Fri, Sat, Sun};
Now, we all know that enums positions are looked at as integers, how would
one go about displaying say "Mon" rather than "1"? For example consider
some more code:
#include <iostream>
#include "stdlib.h"
using namespace std;
enum day_of_week {Mon = 1, Tue, Wed, Thu, Fri, Sat, Sun};
int main()
{
int iChoice;
cout << "Enter a number representing it's corresponding day of the week:
"; cin >> iChoice;
cout << "Your day is " << // what would I type here to access the
corresponding place in day_of_week?
system("PAUSE");
return 0;
}
Thanks for your help