Untitled
unknown
plain_text
3 years ago
701 B
3
Indexable
#ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS #endif #include <iostream> #include <string> #include <time.h> using namespace std; void tidsKalk(const int sekund); int main() { double seconds, days; time_t currentDate; struct tm* Christmas, today; time(¤tDate); today = *localtime(¤tDate); Christmas = localtime(¤tDate); Christmas->tm_mon = 11; // 0 == January, 11 == December Christmas->tm_mday = 25; if (today.tm_mday > 25 && today.tm_mon == 11) Christmas->tm_year = today.tm_year + 1; seconds = difftime(mktime(Christmas), currentDate); days = seconds / 86400; printf("%g days\n", days); return 0; }
Editor is loading...