-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonth.cpp
More file actions
45 lines (38 loc) · 804 Bytes
/
month.cpp
File metadata and controls
45 lines (38 loc) · 804 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
41
42
43
44
45
/*****************************************************
James Bertel
CS111
Lab 3-2
This program will ask for a month (in number format) and tell the season.
*****************************************************/
#include <iostream>
using namespace std;
int main()
{
//declare variables
int month;
//inputs
cout << "Enter a month (1-12): ";
cin >> month;
//outputs
switch(month)
{
case 12:
case 1:
case 2: cout << "winter" << endl;
break;
case 3:
case 4:
case 5: cout << "spring" << endl;
break;
case 6:
case 7:
case 8: cout << "summer" << endl;
break;
case 9:
case 10:
case 11: cout << "fall" << endl;
break;
default: cout << "Invalid month" << endl;
}
return 0;
}