Thread: I need HELP!!

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    4

    Unhappy I need HELP!!

    I'm having soo much trouble writing a code for a date validation program that asks for a user to imput a date, and tell whether it's valid or not. And it also must account for leap years. I'm just getting introduced to this and nothing is going right. I'm getting real stressed out and I need some help. Can anyone help me out?

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Here's a start for you, assuming you want to enter the date as mm/dd/yyyy.

    Read the entire date in as a string and then use a series of if statements to determine if the date is valid. Follow these steps.

    1. Check the first two elements of the array to see if they are both numeric AND within the bounds of mm.
    2. Check the third element to see if it is not numeric.
    3. Check the fourth and fifth elements of the array to see if they're both numeric and within the bounds of dd.
    4. Check the sixth element to see if it's not numeric.
    5. Check the last four elements to see if they're numeric and less than the current year.

    You might also want to try converting the date into a julian date and then checking to see if it's correct.

    -Prelude

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    4

    still need help

    I still can't get this to work. I'm probably just making some careless mistakes somewhere. Thanks for your advice.

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    154
    Look at the code I posted in the "Overloading Constructors" thread. That checks dates & leap years.

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    4

    looping

    I think my program isn't working because I'm not getting it to loop correctly. I'll keep at it.

  6. #6
    Registered User
    Join Date
    Sep 2001
    Posts
    4
    I finally got it to work!! Thanks for the help.

Popular pages Recent additions subscribe to a feed