Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- void main()
- {
- int month = 0;
- int days = 0;
- std::cout << "Enter number of month: ";
- std::cin >> month;
- switch (month)
- {
- case 9:
- case 4:
- case 6:
- case 11:
- days = 30;
- break;
- case 1:
- case 3:
- case 5:
- case 7:
- case 8:
- case 10:
- case 12:
- days = 31;
- break;
- case 2:
- days = 28;
- break;
- default:
- std::cout << "Not a valid month number!" << std::endl;
- break;
- }
- if (days != 0)
- {
- std::cout << "The days in month number " << month << " are: " << days << std::endl;
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment