Lab DayOfWeek - Day of the week

Day of the week

The equation given in the lab for computing the day of the week is:

$dayOfWeek = ( 1 + nYears + nLeapYears + nDaysToMonth + day ) % 7$

Example: Computing the day of the week for April 3, 1933.

You may use the following link to validate your calendar functions http://people.albion.edu/imacinnes/calendar/Day_of_the_Week.html

Output formating

Use the iomanip (#include <iomanip>) functions * setfill() and std::setw() to force your numbers to be right aligned

For example:

#include <iostream>
#include <iomanip>

using namespace std;

int main() {

cout << "without setfill, setw\n";
cout <<  18 << endl;;
cout <<  222 << endl;
cout <<  2321 << endl;

cout << "\nwith setfill, setw\n";

cout << setfill(' ')  <<  std::setw(5) << 18 << endl;;
cout << setfill(' ')  <<  std::setw(5) << 222 << endl;
cout << setfill(' ')  <<  std::setw(5)  << 2321 << endl;
}

Output:

without setfill, setw
18
222
2321

with setfill, setw
   18
  222
 2321