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 58 59 60 61 62 63 64 65 66 67 68 69
|
#include <iostream>
#include <iomanip>
using namespace std;
#define DAYS 31
enum Month { JAN }; //, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC };
enum Day { THR, FRI, SAT, SUN, MON, TUE, WED };
struct calendar_t
{
Month month;
Day day;
};
//Function Prototypes
void displayMonth(calendar_t[]);
int main()
{
calendar_t cal[DAYS];
displayMonth(cal);
return 0;
}
void displayMonth(calendar_t cal[])
{
calendar_t calendar[DAYS];
for (int i = 0; i < 31; i ++)
{
calendar[i].month = static_cast<Month>(i);
calendar[i].day = static_cast<Day>(i);
}
for ( int i = 0; i < 31; i ++)
{
switch (calendar[i].day)
{
case THR: cout << "Thursday, ";
break;
case FRI: cout << "Friday, ";
break;
case SAT: cout << "Saturday, ";
break;
case SUN: cout << "Sunday, ";
break;
case MON: cout << "Monday, ";
break;
case TUE: cout << "Tuesday, ";
break;
case WED: cout << "Wednesday, ";
break;
}
switch (calendar[0].month)
{
case JAN: cout << "January " << i + 1;
}
cout << endl;
}
}
| |