The name of your C program file must be called day2.c, files with any other name will not be marked.
What date of the month is the 2nd Sunday in May 2007? What date of the month is the 3rd Sunday in June 2007?
These are the questions we would like to be able to answer by writing a C program.
You may wish to refer to Lab 1 Odd Week. Here is the question and suggested solutions are HERE and HERE. You may of course write your own solutions to Lab 1 Odd Week.
$ gcc -Wall day2.c -o day2 $ ./day2 Enter year (1800-2299): 2007 Enter month (1=January,2=February,...,12=December): 8 Enter day of the week (1=Monday,2=Tuesday,...,7=Sunday): 4 Enter nth day of the month (1-5): 5 The date of the 5th Thursday of August 2007 is: 30 $ ./day2 Enter year (1800-2299): 2000 Enter month (1=January,2=February,...,12=December): 5 Enter day of the week (1=Monday,2=Tuesday,...,7=Sunday): 7 Enter nth day of the month (1-5): 2 The date of the 2nd Sunday of May 2000 is: 14 $ ./day2 Enter year (1800-2299): 1987 Enter month (1=January,2=February,...,12=December): 1 Enter day of the week (1=Monday,2=Tuesday,...,7=Sunday): 1 Enter nth day of the month (1-5): 1 The date of the 1st Monday of January 1987 is: 5 $
$ cal 12 1987 December 1987 S M Tu W Th F S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 $ cal 2 2000 February 2000 S M Tu W Th F S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 $
A total of 7 different hosts have accessed this document in the last 445 days; your host, nsrp-source.comp.nus.edu.sg, has accessed it 5 times.
If you're interested, complete statistics for this document are also available, including breakdowns by top-level domain, host name, and date.