I'm conducting self-study C++ and currently reaching functions (void, returning-value function, etc).

the requirement is that users will input date in form of "month day year" like 12 25 2002 and the output will show that date's day number, which is day 359 ( 1 1 2002 to be the reference, or day 1).

I'm done with this, but I'm wondering is there any more efficient way to determine how many days in a month

I used this function

I've been thinking about a loop but don't know how to alternate return value between 30 and 31Code:int daysinMonth(int INmonth, int INyear) //Calculate days in months. { switch(INmonth) { case(1): case(3): case(5): case(7): case(8): case(10): case(12): return 31; break; case(2): if (isLeapYear(INyear)) return 29; else return 28; break; case(4): case(6): case(9): case(11): return 30; break; } }

Any insight will be so great!

thanks!