forked from tridibsamanta/CPP_Beginner_to_Expert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CPP020_Enumeration.cpp
46 lines (38 loc) · 1.05 KB
/
CPP020_Enumeration.cpp
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
/**
* Author: Tridib Samanta
* Created: 16.01.2020
**/
#include<iostream>
using namespace std;
enum dayOfWeek {Monday = 1, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday};
string getDay(dayOfWeek);
int main() {
//dayOfWeek d = Wednesday;
//cout<<d<<endl;
//cout<<getDay(Tuesday)<<endl;
cout<<"Enter a day of the week ?"<<endl;
int i;
cin>>i;
cout<<getDay(dayOfWeek(i))<<endl;
return 0;
}
string getDay(dayOfWeek d) {
switch(d) {
case Monday:
return "Hey ! You have selected Monday";
case Tuesday:
return "Hey ! You have selected Tuesday";
case Wednesday:
return "Hey ! You have selected Wednesday";
case Thursday:
return "Hey ! You have selected Thursday";
case Friday:
return "Hey ! You have selected Friday";
case Saturday:
return "Hey ! You have selected Saturday";
case Sunday:
return "Hey ! You have selected Sunday";
default:
return "Hey ! Wrong input !";
}
}