-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAssignment 4.cpp
57 lines (56 loc) · 1.05 KB
/
Assignment 4.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
47
48
49
50
51
52
53
54
55
56
57
/*
Write a C++ program that enter a number(from 1 to 12) from the userand
display the name of day of the month at that number in output assuming 1 as
January and 12 as December, using switch statement.
*/
#include <iostream>
using namespace std;
int main() {
const char* month[12] = { "January","February","March","April","May","June","July",
"August","September","October","November","December" };
int num = 1;
cout << "Enter a Number ( 1 - 12 )\n";
cin >> num;
switch (num) {
case 1:
cout << month[0];
break;
case 2:
cout << month[1];
break;
case 3:
cout << month[2];
break;
case 4:
cout << month[3];
break;
case 5:
cout << month[4];
break;
case 6:
cout << month[5];
break;
case 7:
cout << month[6];
break;
case 8:
cout << month[7];
break;
case 9:
cout << month[8];
break;
case 10:
cout << month[9];
break;
case 11:
cout << month[10];
break;
case 12:
cout << month[11];
break;
default:
cout << "Choose a Number between 1 - 12";
}
cout << "\n";
return 0;
}