1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
#include <iostream>
#include <string>
using namespace std;
int main()
{
int num;
const int days[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
string month[12] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
cout << "Enter the corresponding month number (ex. January = 1): " << endl;
cin >> num;
num--;
cout << month[num] << " has " << days[num] << "days." << endl;
return 0;
}
|