- My Forums
- Tiger Rant
- LSU Recruiting
- SEC Rant
- Saints Talk
- Pelicans Talk
- More Sports Board
- Fantasy Sports
- Golf Board
- Soccer Board
- O-T Lounge
- Tech Board
- Home/Garden Board
- Outdoor Board
- Health/Fitness Board
- Movie/TV Board
- Book Board
- Music Board
- Political Talk
- Money Talk
- Fark Board
- Gaming Board
- Travel Board
- Food/Drink Board
- Ticket Exchange
- TD Help Board
Customize My Forums- View All Forums
- Show Left Links
- Topic Sort Options
- Trending Topics
- Recent Topics
- Active Topics
Started By
Message
re: C# Help. I always have dumb face on.
Posted on 2/4/15 at 4:00 pm to Hu_Flung_Pu
Posted on 2/4/15 at 4:00 pm to Hu_Flung_Pu
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;
}
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 on 2/4/15 at 4:08 pm to MamouTiger65
quote:Don't need to check 4 if you are also checking 400, though it will obviously still work.
(year % 4 == 0 && year % 400 == 0)
Posted on 2/4/15 at 4:22 pm to MamouTiger65
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.
Popular
Back to top
Follow TigerDroppings for LSU Football News