answersLogoWhite

0

You need to check the day, month and year separately, to ensure they are within range. You also need to deal with leap days (29th February) which is every 4 years, but not the 100th unless it is the 400th. Finally, you need to deal with the change from the Julian to Gregorian calendars, which skips the 5th to 14th October, 1582.

bool checkdate(unsigned int d, unsigned int m, unsigned int y)

{

return( !(( d<1 d>31 m<1 m>12 ( y==1582 && m==10 && (d>4 && d<15 )))

( d==31 && ( m==2 m==4 m==6 m==9 m==11 ))

( m==2 && ( d>29 ( d==29 && ( y%4 ( !( y%100 ) && y%400 )))))));

}

User Avatar

Wiki User

13y ago

What else can I help you with?