Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.  
  7. int num;
  8. int days[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
  9.  
  10.  
  11. cout << "Enter a number of the month to see the number of days in that month: ";
  12. cin >> num;
  13.  
  14. if (num > 0 && num <= 12)
  15. {
  16. --num;
  17. cout << "Days of this month equal: " << days[num] << endl;
  18. }
  19. else
  20. {
  21. cout << "Invalid month" << endl;
  22. }
  23.  
  24. //system("pause");
  25. return 0;
  26. } //end of main function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement