Certainly your call to chart() in main is wrong since it does not use the user's input.
Also, your firstDay function is wrong.
If you know that, for example, January 1st, 1901 fell on a Tuesday, then you can
compute that February 1st 1901 fell on a Friday, because January has 31 days,
which is equal to four full weeks plus three additional days. Then you can
compute that March 1st 1901 fell on a Friday also, because February of that year
had 28 days, which is exactly equal to four weeks.
Having said that,
1 2 3 4 5 6 7 8 9 10
|
int firstDay( int month, int year )
{
int firstDayOfYear = newYearDay( year );
// Compute the total number of days in the year in all of the
// months prior to the one the user specified.
// HINT: use a foor loop
return elapseDay%7;
}
| |
Please when (if) you post your code again, use code tags so that it is easier to read.