Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>;
- using namespace std;
- int main()
- {
- int A, B, n = 0, a = 0;//месяц, день
- cout << "Enter A: ";
- cin >> A;
- while(A > 12 || A < 1)
- {
- A = 0;
- cout << "Enter A: ";
- cin >> A;
- }
- cout << "Enter B: ";
- cin >> B;
- while(B > 31 || B < 1)
- {
- B = 0;
- cout << "Enter B:";
- cin >> B;
- }
- cout << A << " " << B << endl;
- for(int i(A); i <= 12; i++)
- {
- if(i % 2 == 0 || i == 1)
- {
- for(int j(B); j <= 31; j = j+7)
- {
- if(7 + j + a > 31)
- {
- a = 30 - n;
- break;
- }
- n = j + 7 - a;
- cout << i << " " << n << endl;
- }
- }
- if(i % 2 == 1 && i != 1)
- {
- for(int j(B); j <= 30; j = j+7)
- {
- if(7 + j + a > 30)
- {
- a = 30 - n;
- break;
- }
- n = j + 7 - a;
- cout << i << " " << n << endl;
- }
- }
- B = 0;
- }
- system("pause");
- retur
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement