C/C++

Кто может помогите пожалуйста !!!!!

Пусть сегодня 01 января 2021 года (пятница). Определить все даты, когда будет ПЯТНИЦА, 13-е в течении ближайших N дней (не анализировать год не «високосность»). Вывести результат в формате dd/mm/yyyy.

Примечание: библиотеками дата/времени не пользоваться .
на (C++)
 #include  
#include
#include
#include
using namespace std;
int input(istream& inp, const char* msg) {
cout > value;
cin.ignore(0x1000, '\n');
return value;
}
class Friday_the_13th {
public:
Friday_the_13th() : pos(5), day(2), month(1), year(1970) {}
string str()const {
string date = day < 10 ? "0" : "";
date += to_string(day) + '/';
if (month < 10) date += '0';
date += to_string(month) + '/' + to_string(year);
return date;
}
int current_pos() {
return pos;
}
int current_day() {
return day;
}
vector get(const int days)const {
static const auto npos = 5;
static const auto nday = 13;
vector box;
if (pos == npos && day == 13) box.push_back(*this);
auto a = *this;
for (auto i = days; i != 0; --i) {
--a;
if (a.current_pos() == npos && a.current_day() == nday) {
box.push_back(a);
}
}
auto b = *this;
for (auto i = 0; i < days; ++i) {
++b;
if (b.current_pos() == npos && b.current_day() == nday) {
box.push_back(b);
}
}
sort(box.begin(), box.end());
return box;
}
private:
int pos;
int day;
int month;
int year;
inline static const int months[]{
0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
friend istream& operator>>(istream& inp, Friday_the_13th& fr) {
fr.day = input(inp, "Day: ");
fr.month = input(inp, "Month: ");
fr.year = input(inp, "Year: ");
return inp;
}
friend const Friday_the_13th& operator++(Friday_the_13th& i) {
if (i.day < i.months[i.month]) ++i.day;
else if (i.day == i.months[i.month]) {
if (++i.month == size(i.months)) {
i.month = 1;
++i.year;
}
i.day = 1;
}
if (i.pos < 7) ++i.pos;
else i.pos = 1;
return i;
}
friend const Friday_the_13th& operator--(Friday_the_13th& i) {
if (i.day > 1) --i.day;
else {
if (--i.month == 0) {
i.month = 12;
--i.year;
}
i.day = i.months[i.month];
}
if (i.pos > 1) --i.pos;
else i.pos = 7;
return i;
}
friend bool operator> date;
auto days = input(cin, "Days: ");
auto dates = date.get(days);
puts(" List:");
for (const auto& date : dates) cout
Александр Ткачук
Александр Ткачук
77 965
Лучший ответ
 #include 
#include

int main() {
int day = 1;
int month = 1;
int year = 2021;
int monthes[] = {
31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31
};
int N;
std::cout > N;
int cday = 12; // Текущий день
int cmonth = 0; // Текущий месяц
int num_days = 0; // Число дней
while (cday < N) {
if (cday % 7 == 0) {
num_days++;
std::cout
OK
Oleg K1M
2 406