Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. #include <iostream>;
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int A, B, n = 0, a = 0;//месяц, день
  7.  
  8.     cout << "Enter A:   ";
  9.     cin >> A;
  10.     while(A > 12 || A < 1)
  11.     {
  12.         A = 0;
  13.         cout << "Enter A:   ";
  14.         cin >> A;
  15.     }
  16.  
  17.     cout << "Enter B:   ";
  18.     cin >> B;
  19.     while(B > 31 || B < 1)
  20.     {
  21.         B = 0;
  22.         cout << "Enter B:";
  23.         cin >> B;
  24.     }
  25.  
  26.     cout << A << "  " << B << endl;
  27.  
  28.     for(int i(A); i <= 12; i++)
  29.     {
  30.             if(i % 2 == 0 || i == 1)
  31.             {
  32.                 for(int j(B); j <= 31; j = j+7)
  33.                 {
  34.                     if(7 + j + a > 31)
  35.                     {
  36.                         a = 30 - n;
  37.                         break;
  38.                     }
  39.                     n = j + 7 - a;
  40.                     cout << i << "  " << n << endl;
  41.                 }
  42.             }
  43.             if(i % 2 == 1 && i != 1)
  44.             {
  45.                 for(int j(B); j <= 30; j = j+7)
  46.                 {
  47.        
  48.                     if(7 + j + a > 30)
  49.                     {
  50.                         a = 30 - n;
  51.                         break;
  52.                     }
  53.                     n = j + 7 - a;
  54.                     cout << i << "  " << n << endl;
  55.                 }
  56.             }
  57.             B = 0;
  58.     }
  59.  
  60.     system("pause");
  61.     retur
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement