10.09.2010, 13:46
Alright now i took another try:
I think for the beginning this should be enough. It doesn't calculate the gay-februaries correctly, yet, but that won't be that complicated.
#Edit: If anybody doesn't understand the reason why there are so many printf's, it's for me to see if everythign works fine.
pawn Код:
CalculateDaysBetweenDates(d1,m1,y1,d2,m2,y2)
{
d2-=d1;
if(y1!=y2)
{
while(y1!=y2)
{
printf("%i;%i;%i;%i", d2,m1,y1,ddiff);
ddiff+=days[m1-1];
m1++;
if(m1==13)
{
y1++;
m1=1;
}
printf("%i;%i;%i;%i", d2,m1,y1,ddiff);
}
ddiff+=d2;
return ddiff;
}
else if(y1==y2)
{
if(m1!=m2)
{
while(m1!=m2)
{
printf("%i;%i;%i;%i", d2,m1,y1,ddiff);
ddiff+=days[m1-1];
m1++;
if(m1==13)
{
y1++;
m1=1;
}
printf("%i;%i;%i;%i", d2,m1,y1,ddiff);
}
ddiff+=d2;
return ddiff;
}
else if(m1==m2)
{
return d2;
}
else return print("Calculation Error");
}
else return print("Calculation Error");
}
#Edit: If anybody doesn't understand the reason why there are so many printf's, it's for me to see if everythign works fine.