Question: Using C++,input a month, day and a year, as in: 6 18 2014 Using the algorithm given in class, output the Day of the Week.

Using C++,input a month, day and a year, as in: 6 18 2014 Using the algorithm given in class, output the Day of the Week. You will need the following table corresponding to the 12 months. Jan 1 Feb 4 Mar 4 Apr 0 May 2 Jun 5 Jul 0 Aug 3 Sept 6 Oct 1 Nov 4 Dec 6 Pseudo-Code in English (sort of) read in the Month, Day, and a 4 digit Year convert the Month over to the table entry t = table entry + day + year + 6 t = t + year / 4 - year / 100 + year / 400 adjust t for January and February of a leap year compute the day of the week - dotw = t % 7; using dotw, print the day of the week Here is part of the program in English and a few statements in C++. #include  using namespace std; int main() { declarations of variables go here display directions to the user read in the month, day, and year if (month == 1) te = 1; etc - - t = te + Day + year + 6; t = t + year / 4 - year / 100 + year / 400; /* leap year adjustment */ if ((year % 400 == 0) && (month <= 2)) t = t - 1; else if (year % 100 == 0) {} /* not a leap year */ else if ((year % 4 == 0) && (month <= 2)) t = t - 1; dotw = the remainder after dividing t by 7 if (dotw == 0) cout << "Saturday" << endl; etc - - } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!