KR041.c a short sample program that determines if a given year is a leap year. Given the additional information that January 1, 1900 is a Monday, the following short exercise programs require you to compute and output day-of-the-week information. They may eventually lead to the UNIX “cal” program, which generates calendars such as this. A concatenation of all calendars between 1900 and 2100 can be found here to help you verify your answer.
4.1. Write a program to read in a year between 1900 and 2100, then print out 0 if the first day of that year is a Sunday, 1 if it is a Monday, etc.
4.2. Modify program 4.1 to repeat the process until –999 is entered.
4.3. Modify program 4.1 to list the same day-of-the-week information for all years between 1900 and 2100 in increasing order.
4.4. Write a program to read in a month and a year between 1900 and 2100, then print out 0 if the first day of that month is a Sunday, 1 if it is a Monday, etc.
4.5. Modify program 4.4 to list the same day-of-the-week information for all months between January 2000 and December 2010 in increasing order.
Extra point problem:
4.6. Write a program to copy the standard input to the standard output while removing all C++ style comments, i.e., “//...” all the way to the end of the line. (This should remind you of the preprocessor discussed in class. What other features of a preprocessor can you implement? Probably not much at this moment, but by the end of the semester you will be able to do a lot more.)
How to turn in your assignment