Learnem Educational
May 18, 2012, 01:05:23 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Help with writing a calendar program  (Read 1148 times)
Anonymous
Guest
« on: September 04, 2002, 12:46:32 PM »

:?
 :?: I Would really appreciate some help with this task, to start me off, becuase i am a really new c programmer, and i have no idea how to start and the processes i need to go through. If anyone can give me any example code that would be fantastic. Thank you in advance.

 :D
--------------------------------------------------------------------------------------

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
« Last Edit: January 01, 1970, 12:00:00 AM by Anonymous » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!