-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPractice.cpp
More file actions
26 lines (18 loc) · 734 Bytes
/
Practice.cpp
File metadata and controls
26 lines (18 loc) · 734 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
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main(){
const int NUM_MONTHS = 12;
int choice;
string name[NUM_MONTHS] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
int days[NUM_MONTHS] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
cout << "This program will tell you how many days are in any month. \n\n";
for ( int month = 1; month <= NUM_MONTHS; month++ ){
cout << setw(2) << month << " " << name[month-1] << endl;
}
cout << "\nEnter the number of the month you want: ";
cin >> choice;
cout << "The month of " << name[choice-1] << " has " << days[choice-1] << " days in it.\n";
return 0;
}