From: Christian Beckel <Christian.Beckel@gmx.de>
To: linux-c-programming@vger.kernel.org
Subject: Re: A Calendar app on C
Date: Wed, 2 Jun 2004 09:10:41 +0200 [thread overview]
Message-ID: <200406020910.41006.Christian.Beckel@gmx.de> (raw)
In-Reply-To: <Pine.LNX.4.58.0406012354140.12322@ns.isi.ulatina.ac.cr>
Hi,
there are several possibilities to compute the number of days in a month or if
there is a leap or not.
if (i == 2)
days = 28;
else
days = 31 - ( (i != 4 || i != 6 || i != 9 || i != 11) ? 1 : 0 );
I think there is no simpler way, because the numbers of months are unregular.
> Hi.
>
> I am trying to program a basic calendar software in C. The idea is to ask
> for a year and display all the calendar from january to december. How to
> code such app taking care of 31/28 days month and check each 4 year for a
> leap year? Any idea/comment/advice/code is welcome.
>
>
> best regards,
>
> ---
> Fabio Andres Miranda
> Ingenieria de sistemas informaticos
> Universidad Latina - Costa Rica
>
> -
> To unsubscribe from this list: send the line "unsubscribe
> linux-c-programming" in the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2004-06-02 7:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-02 5:58 A Calendar app on C Fabio Miranda Hamburger
2004-06-02 7:10 ` Christian Beckel [this message]
2004-06-02 7:17 ` Christian Beckel
2004-06-02 9:18 ` John T. Williams
2004-06-02 10:38 ` wwp
2004-06-02 10:07 ` Glynn Clements
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200406020910.41006.Christian.Beckel@gmx.de \
--to=christian.beckel@gmx.de \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.