Thread: Working out leap years.

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    4

    Working out leap years.

    Hey i need some help working out wether a year is a leap year or not. Just needs to return a boolean value. What would be placed in my code?

    Code:
    bool Date::isLeapYear()
    {
    }
    I've tried a few things and certain dates dont return a correct value. I know its something to do with dividing by 100 and 400 but i cant get it right.
    Cheers.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Search: Key Word(s): leap, year
    Thread / Thread Starter Last Post Replies Views Forum

    Showing results 1 to 25 of 88
    Search took 4.34 seconds. Search: Key Word(s): leap, year
    Thread / Thread Starter Last Post Replies Views Forum

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    4
    Yes i have searched but i cant find anything in C++ that is exactly what i require. I only want a simple answer if that isnt too much to ask. It only has to be the formula. I will be calling it later on in the program.

  4. #4
    @codeguru
    Join Date
    Jan 2006
    Posts
    34
    whats a leap year? i might be able to help

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Well you're obviously not looking hard enough
    http://cboard.cprogramming.com/showt...ight=leap+year

    If you're always going to give up on anything which takes more than 5(seconds,clicks), then you're not cut out for software.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. why does this program say 1700 is a leap year?
    By newbcore in forum C Programming
    Replies: 7
    Last Post: 12-19-2008, 02:03 AM
  2. Delete Files Older than 2 years
    By Dragoon_42 in forum C++ Programming
    Replies: 10
    Last Post: 05-17-2007, 04:13 PM
  3. Little help with leap years
    By Jayhawk_26 in forum C Programming
    Replies: 17
    Last Post: 10-05-2006, 02:03 PM
  4. Problem with simple case statements
    By shoobsie in forum C Programming
    Replies: 2
    Last Post: 05-08-2006, 08:39 AM
  5. Counter Errors for otherwise working program???
    By jereland in forum C Programming
    Replies: 7
    Last Post: 03-22-2004, 08:37 PM