Started By
Message

re: C# Help. I always have dumb face on.

Posted on 2/4/15 at 4:00 pm to
Posted by MamouTiger65
Baton Rouge, La
Member since Oct 2007
799 posts
Posted on 2/4/15 at 4:00 pm to
Sounds like you are looking for something like this.

int days = 0;


switch (month)
{
case "September":
days = 30;
break;
case "April":
days = 30;
break;
case "June":
days = 30;
break;
case "November":
days = 30;
break;
case "February":
if((year % 4 == 0 && year % 100 != 0) || (year % 4 == 0 && year % 400 == 0))
{
days = 29;
}
else
{
days = 28;
}
break;
default:
days = 31;
break;
}
Posted by Korkstand
Member since Nov 2003
28738 posts
Posted on 2/4/15 at 4:08 pm to
quote:

(year % 4 == 0 && year % 400 == 0)
Don't need to check 4 if you are also checking 400, though it will obviously still work.
Posted by Hu_Flung_Pu
Central, LA
Member since Jan 2013
22234 posts
Posted on 2/4/15 at 4:22 pm to
quote:

MamouTiger65



That looks like what he showed another student. The problem is I don't know why to put
if((year % 4 == 0 && year % 100 != 0) || (year % 4 == 0 && year % 400 == 0))

I know that it is a boolean statement but I wouldn't know how to correctly code it. I would never have guessed to put it in that fashion. If that makes sense.
first pageprev pagePage 1 of 1Next pagelast page
refresh

Back to top
logoFollow TigerDroppings for LSU Football News
Follow us on Twitter, Facebook and Instagram to get the latest updates on LSU Football and Recruiting.

FacebookTwitterInstagram