|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello,
I am just trying to get a good grasp on enums. I created this code just to test to see if i knew how to do it. But i got an error having to do with the ">>" operator. Anyways.. this is wat i have, anyhelp would be greatly appreaciated. Thanks. PHP Code:
|
|
#2
|
||||
|
||||
|
Try this instead:
Code:
#include <iostream.h>
enum Day {
MON=1,
TUE,
WED,
THU,
FRI,
SAT,
SUN};
int main() {
int x;
cout << "What day do you want off?";
cin >> x;
switch(x) {
case MON:
cout << "Monday";
break;
case TUE:
cout << "Tuesday";
break;
case WED:
cout << "Wednesday";
break;
case THU:
cout << "Thursday";
break;
case FRI:
cout << "Friday";
break;
case SAT:
cout << "Saturday";
break;
case SUN:
cout << "Sunday";
break;
default:
cout << "I don't understand your answer";
break;
}
return 0;
Make sense? |
|
#3
|
|||
|
|||
|
allright thanks man that worked
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > Simple Enumeration |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|