12-enum.c 602 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include <stdio.h>
  2. typedef enum {
  3. MONDAY,
  4. TUESDAY,
  5. WEDNESDAY,
  6. THURSDAY,
  7. FRIDAY,
  8. SATURDAY,
  9. SUNDAY
  10. } Day;
  11. int main() {
  12. Day today = TUESDAY;
  13. switch (today) {
  14. case MONDAY:
  15. printf("It's Monday.\n");
  16. break;
  17. case TUESDAY:
  18. printf("It's Tuesday.\n");
  19. break;
  20. case WEDNESDAY:
  21. printf("It's Wednesday.\n");
  22. break;
  23. case THURSDAY:
  24. printf("It's Thursday.\n");
  25. break;
  26. case FRIDAY:
  27. printf("It's Friday.\n");
  28. break;
  29. case SATURDAY:
  30. printf("It's Saturday.\n");
  31. break;
  32. case SUNDAY:
  33. printf("It's Sunday.\n");
  34. break;
  35. }
  36. return 0;
  37. }