Skip to content

Instantly share code, notes, and snippets.

@m-primo
Last active April 25, 2020 14:45
Show Gist options
  • Save m-primo/2f8a351740f3cb1f6392782d0123c1f8 to your computer and use it in GitHub Desktop.
Save m-primo/2f8a351740f3cb1f6392782d0123c1f8 to your computer and use it in GitHub Desktop.
days in month - c++
cin >> month_num;
switch (month_num)
{
case 1:case 3:case 5:case 7:case 8:case 10:case 12:
daysinmonth = 31;
break;
case 2:
daysinmonth = 28;
break;
case 4: case 6: case 9: case 11:
daysinmonth = 30;
break;
default:
daysinmonth = -1;
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment