Предмет: Информатика, автор: taniyham

Запитати дату (день, місяць, рік) і вивести наступну дату. Зважте на можливість
переходу на наступний місяць, рік, а також високосний рік.
С++


flash77779: Виконав

Ответы

Автор ответа: flash77779
0

#include <iostream>

#include <string>

#include <ctime>

#include <chrono>

#include <iomanip>

using namespace std;

int main()

{

   int day, month, year;

   cout << "Enter the day: ";

   cin >> day;

   cout << "Enter the month: ";

   cin >> month;

   cout << "Enter the year: ";

   cin >> year;

   tm next_day = {0, 0, 0, day, month - 1, year - 1900};

   mktime(&next_day);

   next_day.tm_mday += 1;

   mktime(&next_day);

   cout << "The next date is: " << put_time(&next_day, "%Y-%m-%d") << endl;

   return 0;

}

Приложения:
Похожие вопросы
Предмет: Алгебра, автор: dorogakarina1
Предмет: Физика, автор: sorocinskaveronika1