Advertisement
dllbridge

Untitled

Nov 19th, 2023
716
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.88 KB | None | 0 0
  1.  
  2. #include  <string>
  3. #include <stdio.h>
  4. #include  <vector>
  5. #pragma warning(disable : 4996)
  6.  
  7. using namespace std;
  8.  
  9. namespace year
  10. {
  11.     const char* monthes[15] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
  12.     vector<int> days = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
  13.     int nowyear;
  14. }
  15.  
  16.  
  17. using namespace year;
  18.  
  19. //////////////////////////////////////////
  20. int main()
  21. {
  22.    
  23.     bool visc = false;
  24.    
  25.     printf("enter year : ");
  26.     scanf("%d", &nowyear);
  27.    
  28.    
  29.     if(nowyear % 4 == 0)
  30.     {
  31.         days[1] =   28;
  32.         visc    = true;
  33.     }
  34.    
  35.     for(int i = 0; i < 12; i++)
  36.     {
  37.         printf("%10s has %d days\n", monthes[i], days[i]);
  38.     }
  39.    
  40.     if (visc) printf("-----------------------\nFebruary destructor works.      ");
  41.     else      printf("-----------------------\nFebruary destructor doesnt work.");
  42. }
  43.  
  44.  
  45.  
  46.  
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement