-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
40 lines (35 loc) · 792 Bytes
/
test.cpp
File metadata and controls
40 lines (35 loc) · 792 Bytes
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
#include <iostream>
using namespace std;
enum DayOfWeek{Null, SUN, MON, TUE, WED, THU, FRI, SAT};
string nameDayOfWeek(int);
int main()
{
int d;
cout << "Enter a day number (between 1 and 7): " << endl;
cin >> d;
day = static_cast<DayOfWeek>(d);
cout << "Day of the week is " << nameDayOfWeek(d) << endl;
return 0;
}
string nameDayOfWeek(DayofWeek day){
string d = "null";
switch (day){
case 1: d = "Sunday";
break;
case 2: d = "Monday";
break;
case 3: d = "Tuesday";
break;
case 4: d = "Wednesday";
break;
case 5: d = "Thursday";
break;
case 6: d = "Friday";
break;
case 7: d = "Saturday";
break;
default:
break;
}
return d;
}