Again a quite simple question. I've been struggling all night.
Why does it not jump into the if-condition if month = 11? It just skips this the if statements. I think normally the debugger would check each if statement but here the compiler isn't doing anything. It's just skipped.
int get_weekday(int day, int month, int year)
{
int nday, nmonth, nyear, jahrhinten, ncentury, nleapyear, res, weekday;
nday = day % 7;
printf("%i\n", month);
if ((month == 1) || (month == 10))
{
nmonth == 0;
}
else if(month == 5)
{
nmonth == 1;
}
else if(month == 8)
{
nmonth == 2;
}
else if ((month == 2) || (month == 3) || (month == 11))
{
nmonth == 3;
}
else if(month == 6)
{
nmonth == 4;
}
else if ((month == 9) || (month == 12))
{
nmonth == 5;
}
else if ((month == 4) || (month == 7))
{
nmonth == 6;
}
jahrhinten = year - 2000;
nyear = (jahrhinten +(jahrhinten / 4)) % 7;
ncentury = (3-(20 % 4))*2;
if(((year % 4)== 0) && (month == 1 || month == 2))
{
nleapyear = 6;
}
else
{
nleapyear = 0;
}
res = nday + nmonth + nyear + ncentury + nleapyear;
weekday = res % 7;
return res;
}
Thank you really much in advance.
Aucun commentaire:
Enregistrer un commentaire