help writing "switch" statement

Hi all,

This is a continuation of my previous thread about the banking system that I have been working on. My professor wants us to incorporate specific dates when processing each of the options (deposits, withdrawals, etc.) in Part B of the assignment. I know that I need to use a "switch" statement, courtesy of matsp, to initiate the month and day. However, I don't seem to understand how it works. This is what I have tried to run so far:

The actual code for the banking system is much longer than this, but I simplified it down to the part that I need help with. In addition, I did not include a "default" in my "switch" statement because I don't understand how that part is supposed to work. I have also tried following many tutorials that attempt to explain the "switch" statement, but haven't gotten much headway. With that said, I would greatly appreciate it if someone could point me in the right direction with this, including an example that I can reference as well. Thanks!

>I did not include a "default" in my "switch" statement because I don't understand how that part is supposed to work.
For your switch it would be code you wanted executed for the case of an invalid month (not in the range of 1 to 12). An error handling case for when the user enters invalid input.

Presuming 1 is for january and 12 is for december, there's no "real" need to use a switch statement (i agree this is the simplest way tough, and if you want to know, i may have done it that way either).
But, here's another way (i'm throwing this just to let you know, don't mind using it)

Code:

if (month == 2)
// That's the silly february month, add some special traitement to determine if it's 28 or 29 days
days = 28;
else if ((month + month / 8) &#37; 2 == 1)
days = 31;
else
days = 30;

Haha. In fact, i forgot this was "that" complex, since July (7) and August (8) have both 31 days... someone has a better "analytical way" of doing so ?

Presuming 1 is for january and 12 is for december, there's no "real" need to use a switch statement (i agree this is the simplest way tough, and if you want to know, i may have done it that way either).