
// Days of the week programming problem
// Given the date in month/day/year form, report the day of the week

#include <iostream.h>

int main() {
   int day;
   int month;
   int year;
   int dayofweek;

   cout << "Please enter a month, day, and year as integers." << endl;
   cout << "(separated by spaces): ";
   cin >> month >> day >> year;

   if(month < 3) {
      month = month + 12;
      year = year - 1;
   }

   dayofweek = day + 2 * month +
        int(0.6 * (month + 1) + year + year / 4 - year / 100 + year / 400);

   dayofweek = dayofweek % 7;

   if(dayofweek == 0)
      cout << "Monday.";
   else if(dayofweek == 1)
      cout << "Tuesday.";
   else if(dayofweek == 2)
      cout << "Wednesday.";
   else if(dayofweek == 3)
      cout << "Thursday.";
   else if(dayofweek == 4)
      cout << "Friday.";
   else if(dayofweek == 5)
      cout << "Saturday.";
   else if(dayofweek == 6)
      cout << "Sunday.";

   cout << endl;

   return 0;
}

