leap year

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amit17ghadi
    New Member
    • Oct 2007
    • 1

    leap year

    I want leap year programme in c++. can u help me?
  • sanctus
    New Member
    • Mar 2007
    • 84

    #2
    Originally posted by amit17ghadi
    I want leap year programme in c++. can u help me?

    What have you done so far?

    Comment

    • Banfa
      Recognized Expert Expert
      • Feb 2006
      • 9067

      #3
      Only if you try first please read our Posting Guidelines.

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        D you understand how to calculate a leap year?

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          Originally posted by weaknessforcats
          D you understand how to calculate a leap year?
          Yep: calulate the Julian day number using Zeller's congruence on the dates 1/1/x
          and 1/1/(x+1) subtract the first from the second and see what the outcome is: if it is
          366 year x is a leap year.

          kind regards,

          Jos ;-)

          Comment

          • weaknessforcats
            Recognized Expert Expert
            • Mar 2007
            • 9214

            #6
            Originally posted by JosAH
            Yep: calulate the Julian day number using Zeller's congruence on the dates 1/1/x
            and 1/1/(x+1) subtract the first from the second and see what the outcome is: if it is
            366 year x is a leap year.
            Whatever happened to determining a leap year as divisible by 4 but not by 400 ??

            Comment

            • Banfa
              Recognized Expert Expert
              • Feb 2006
              • 9067

              #7
              Originally posted by weaknessforcats
              Whatever happened to determining a leap year as divisible by 4 but not by 400 ??
              Nothing because that is wrong it is

              divisible by 4 but not by 100 except if it is divisible by 400 hence 2000 was a leap year.


              The formula Jos mentions I image is just his warped sense of humour :D and anyway it appears to be a formula for week day so the difference he suggest should be in the range -7 <= result <= 7.

              Comment

              Working...