-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonth_name_switch.cpp
More file actions
55 lines (51 loc) · 1.07 KB
/
month_name_switch.cpp
File metadata and controls
55 lines (51 loc) · 1.07 KB
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
/*
* Problem:
* Use a switch statement to print the name of the month based on an input number between 1 and 12.
*/
#include <iostream>
using namespace std;
int main() {
int month;
cin >> month;
switch (month) {
case 1:
cout << "January";
break;
case 2:
cout << "February";
break;
case 3:
cout << "March";
break;
case 4:
cout << "April";
break;
case 5:
cout << "May";
break;
case 6:
cout << "June";
break;
case 7:
cout << "July";
break;
case 8:
cout << "August";
break;
case 9:
cout << "September";
break;
case 10:
cout << "October";
break;
case 11:
cout << "November";
break;
case 12:
cout << "December";
break;
default:
cout << "Invalid Number";
}
return 0;
}