void DayClose(int k, Date d1, Date d2) { int numberOfDays = thisIsMagic(d2.year, d2.month, d2.day) - thisIsMagic(d1.year, d1.month, d1.day); int i = d1.day; if (d1.month == 1 || d1.month == 3 || d1.month == 5 || d1.month == 7 || d1.month == 8 || d1.month == 10 || d1.month == 12) { if (d1.month < d2.month) { for (i;i < 31;i++) { if (get_day(i, d1.month, d1.year) == k) { cout << "that day" << endl; cout << d1.year << " " << d1.month << " " << i; break; } if (i == 31) { d1.month++; i = 1; } } } } else if (d1.month == 4 || d1.month == 6 || d1.month == 9 || d1.month == 12) { if (d1.month < d2.month) { for (i;i < 30;i++) { if (get_day(i, d1.month, d1.year) == k) { cout << "that day" << endl; cout << d1.year << " " << d1.month << " " << i; break; } if (i == 30) { d1.month++; i = 1; } } } } else if (d1.month == 2) { if (d1.month < d2.month) { for (i;i < 28;i++) { if (get_day(i, d1.month, d1.year) == k) { cout << "that day" << endl; cout << d1.year << " " << d1.month << " " << i; break; } if (i == 28) { d1.month++; i = 1; } } } } int numberOfDays2 = thisIsMagic(d2.year, d2.month, d2.day) - thisIsMagic(d1.year, d1.month, i); int dis = numberOfDays - numberOfDays2; }