Im really new at c, and i have an assignment that i have no idea of where to even start. I know the very basics of c, but i need a push in the right direction of where to even start with writing this program. If anyone can give me some example code that i can learn from, or can describe step by step in terms that a two year old would understand the steps that i would go through to write this proggy. Any help would be fantastic... I thank you in advance.
Here is the whole task:
My task is to write a C program calen that displays calendar details about specified dates. The program reads commands from standard input that specify what calendar information to display. Commands can be of several forms:
If the command is of the form "d dd mm yyyy", where dd, mm, and yyyy are integers representing the day, month, and year, the program prints a line reporting the weekday for the given date:
d 1 1 2000
1 January 2000 is a Saturday
If the year, month, or day are omitted, the program substitutes information for the current date. Thus (assuming the current date is 24 August 2002):
d 31 12
31 December 2002 is a Tuesday
d 15
15 August 2002 is a Thursday
d
24 August 2002 is a Saturday
If the command is of the form "m mm yyyy", the program
prints a calendar for the given month:
m 12 1999
December 1999
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
Note that the display consists of 6 "week" lines, even if (as in
this example), the final week (or 2 weeks for February in some
years) is entirely blank. If the year or month are omitted, the
program uses information for the current date instead.
If the command is of the form "y yyyy", the program
prints a calendar for the entire given year:
y 1998
1998
Jan Feb Mar
S M Tu W Th F S S M Tu W Th F S S M Tu W Th F S
1 2 3 1 2 3 4 5 6 7 1 2 3 4 5 6 7
4 5 6 7 8 9 10 8 9 10 11 12 13 14 8 9 10 11 12 13 14
11 12 13 14 15 16 17 15 16 17 18 19 20 21 15 16 17 18 19 20 21
18 19 20 21 22 23 24 22 23 24 25 26 27 28 22 23 24 25 26 27 28
25 26 27 28 29 30 31 29 30 31
Apr May Jun
S M Tu W Th F S S M Tu W Th F S S M Tu W Th F S
The months are arranged in 4 rows (with the first row displaying
calendars for Jan, Feb, and Mar), and the months in a row
separated by 3 blank spaces. There should be no blank line
between rows unless (as here) the last week of all months happens
to be blank. Note the alignment of the day-of-the week letters,
the month names, and the year. If the year is omitted, the
current year is used instead.
If the command begins with a digit, then "day" format is
assumed. Thus 26 1 2000 is equivalent to d 26 1
2000.
If the command begins with any other character, the program
prints an error message:
f 24 8 2002
Unknown command: f