Date searching
Hello gang,
Could someone please have a look at my 'if' setup. I wrote a function
to find all dates in a file between the from and to structs. As you see I
have set the initial variables to near infinity. If I don't change the
dates all the records in my file are called. However, if I put in a range
I often get nothing even though I have checked and confirm dates in the
range. Although this algorythm looks good to me, can anyone tell me whats
going wrong? Or, if you have some school taught method for this I would
appreciate your help as all I know from programming is what I learn from a
book at home. I'm using an old Manx 3.6 compiler.
date_search()
{
struct date actual, from, to;
from.day = 01, from.month = 01, from.year = 0000;
to.day = 31, to.month = 12, to.year = 9999;
if (actual.year >= from.year && actual.year <= to.year &&
actual.month >= from.month && actual.month <= to.month)
if (actual.day >= from.day && actual.day <= to.day ||
actual.day < from.day && actual.month > from.month ||
actual.day > to.day && actual.month < to.month)
}
THANKS FOR THE HELP! Henry