number of days between two dates

Hi all,
I am looking to write a program for calculating number of days between two dates.
Please help me with the logic for the same.
Give me some pseudocode or reference material..to make me understand how to do it??
If you understand this, you could make a counter that counts each day that passes and put that in a do-while loop. Then you can say that if the counter passes the date 31 (or maybe 30 for another month) to start counting from one again. You will need two separate variables though. I hope you understand!?
the input is not for only one year..
it has to consider leap years as well.
1 jan 1900 to 7 jan 1907
it shud consider all years from 1900 to 1907..and calculate all days of all months in all these 7 years.
I am not sure whether its good/valid one...may be you can find the time difference using difftime() in ctime.h and convert that into days or use some other libraries like boost.
Topic archived. No new replies allowed.