Запитати дату (день, місяць, рік) і вивести наступну дату. Зважте на можливість
переходу на наступний місяць, рік, а також високосний рік.
С++
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;
}
Приложения:


Похожие вопросы
1 год назад
1 год назад
1 год назад
1 год назад
2 года назад
2 года назад
8 лет назад