ItsJustMe
Silver Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору #include "stdafx.h" #include <time.h> int _tmain(int argc, _TCHAR* argv[]) { int y = 0; bool b = true; _tprintf_s(_T("Year of your birth: ")); _tscanf_s(_T("%d"), &y); if (y > 1900) { time_t ltime; tm newtime; time(<ime); if (!localtime_s(&newtime, <ime)) { newtime.tm_year += 1900; y = newtime.tm_year - y; if (y >= 0) { int r = newtime.tm_year + (10 - (y % 10)); _tprintf_s(_T("\nYour next jubilee (%d years old) will be in %d year."), ((y / 10) + 1) * 10, r); b = false; } } } if (b) _tprintf_s(_T("\nYear of your birth seems to be wrong.")); return 0; } |