-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01oct_3.c
50 lines (45 loc) · 943 Bytes
/
01oct_3.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <stdio.h>
// Define an enum for the days of the week
enum Days {
SUNDAY,
MONDAY,
TUESDAY,
WEDNESDAY,
THURSDAY,
FRIDAY,
SATURDAY
};
// Typedef the enum to create a new type
typedef enum Days Day;
int main() {
Day today = MONDAY;
printf("Today is ");
switch(today) {
case SUNDAY:
printf("Sunday");
break;
case MONDAY:
printf("Monday");
break;
case TUESDAY:
printf("Tuesday");
break;
case WEDNESDAY:
printf("Wednesday");
break;
case THURSDAY:
printf("Thursday");
break;
case FRIDAY:
printf("Friday");
break;
case SATURDAY:
printf("Saturday");
break;
default:
printf("Unknown day");
break;
}
printf("\n");
return 0;
}