#1: You don't need to double space everything. It's too hard to read.
#2: You need to indent consistently, and 3-4 spaces, not 1 or 2
#3: "it is bringing some bit of a problem" has no meaning. What is the problem. Describe it, don't make us guess.
WaltP
Posting Sage w/ dash of thyme
10,492 posts since May 2006
Reputation Points: 3,348
Solved Threads: 943
difference in days between two dates is very easy to calculate.
1. get time_t for first date. If this is not today's date, then fill out a struct tm with day, month-1, year-1900 -- make all other structure members 0, then pass your struct tm object to mktime(), which will convert it to time_t.
2. get time_t for second date
3. subtract them -- this is difference between two dates in seconds
4. there are 24 * 60 * 60 seconds in one day. So take the result of step 3 above and divide by the number of seconds in one day.
5. finished.
#include <iostream.h>
#include <cdate.h>
1. iostream.h is very old and obsolete. current version does not have .h file extension. If you are using an acient compiler such as Turbo C++ then this is ok because your compiler probably does not support the new file naming convention.
2. cdate.h -- there is no such file. use either date.h or cdate (no file extension). This is how it might appear for modern compilers.
#include <iostream>
#include <cdate>
Ancient Dragon
Retired & Loving It
30,046 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,342