#include #include #include "calType.h" using namespace std; // Other Routines void CommentOnMonth(MonthT month); void GetMonthName(string & name); int main () { MonthT i,month; string input; MonthT randomMonth; // initialize the random number generator exactaly once srand(time(NULL)); //I don't rally like this. for(i=JANUARY; i<= DECEMBER;i= MonthT(i + 1)) { cout << "Month number " << i << " is " << MonthTToString(i) << endl; } cout << endl << endl; // I like this much bettter for(i=FIRST_MONTH; i<= LAST_MONTH; i = NextMonth(i)) { cout << "Month number " << i << " is " << MonthTToString(i) << endl; } cout << endl << endl; // look you have to prime the pump here too! GetMonthName(input); while (input != "QUIT") { month = StringToMonthT(input); if (month == NO_MONTH) { randomMonth = MonthT(rand() % MONTHT_SIZE); cout << " That is not a valid month, did you mean " << MonthTToString(randomMonth) << "?" << endl; } else { CommentOnMonth(month); } cout << endl; GetMonthName(input); } return 0; } void CommentOnMonth(MonthT month) { if (JUNE == month || JULY == month || AUGUST == month) { cout << "I really like the month of " << MonthTToString(month) << "!" << endl; } else if (APRIL == month || MAY == month || SEPTEMBER == month || OCTOBER == month) { cout << MonthTToString(month) << " is a mild month, not too bad" << endl; } else { cout << MonthTToString(month) << ", look out, SNOW!"<< endl; } } void GetMonthName(string & name){ int i; cout << " Enter a month name (or QUIT to quit) =>"; cin >> name; for(i=0;i