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!Code:int month, days; printf("Enter the transaction month (1-12): "); scanf("%d", month); switch (month) { case 1: days = 31; \\This represents the month of January. break; ... case 12: days = 31; \\This represents the month of December. break; } printf("Number of days in this month: %d\n\n", days);