[C++] does not pad year with zeros though[C++] does not pad year with zeros though
📅
Friday 13th
Week 7, 2026
//Paste your solution here if you want to share it publicly#include
#include
#include
int main() {
for (int year = 0001; year <= 9999; ++year)
{
for (int month = 0; month < 12; ++month)
{
std::tm time_in = {0, 0, 0, 13, month, year - 1900}; // 13th day
std::time_t time_temp = std::mktime(&time_in);
std::tm *time_out = std::localtime(&time_temp);
if (time_out->tm_wday == 5)
{ // 5 corresponds to Friday
std::cout << std::put_time(time_out, "%Y-%m-%d") << std::endl;
}
}
}
return 0;
}