Possible to learn without education? (54)

29 Name: #!/usr/bin/anonymous : 2008-04-28 02:56 ID:mGTY1Ydf

>>27

ORLY?

So you would do something like the idiot prof wanted. Maybe create an array of 12 items, one for each month with he value being the # of days in that month.

The use a magic number to specify what day of the week January 1st is for the current year. Then loop through the array starting at 0 (January) and add up all the number of days up to the month before the selected month. Then add 1. Then figre out what day that is based on what day January 1st was.

Then create an array of 42 elements. Starting at the first day of the week element in the array, loop through filling each item with a number that is 1 larger than the one before it.

Then loop through the array and print out your calendar.

Or an alerternative would be to create another month array and fill it with a number representing the day of the week that the first of that month falls on. This way you get the joy of manually looking this up on a real calendar (because it makes total sense to use another calendar to make a calendar).

If you can't see why this approach is completly wrong, then you are not a real programmer.

This thread has been closed. You cannot post in this thread any longer.