This commit is contained in:
Kyryl Kobzar 2019-03-12 21:10:21 +01:00
parent b65645ed8a
commit 5681a7d1cc
2 changed files with 12 additions and 9 deletions

BIN
program Executable file

Binary file not shown.

View File

@ -1,13 +1,16 @@
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
int main(){ int main()
//int day = 0; {
//int mounth = 0; /* initialize */
//int year = 0; int y=0, m=0, d=0;
//scanf("%d.%d.%d", &day, &mounth, &year); fgets("%d.%d.%d", &d, &m, &y);
time_t time; struct tm t = { .tm_year=y-1900, .tm_mon=m-1, .tm_mday=d };
scanf("%e.%m.%Y", &time); /* modify */
printf("%e.%m.%Y", time); t.tm_mday += 40;
mktime(&t);
/* show result */
printf("%s", asctime(&t)); /* prints: Sun Mar 16 00:00:00 1980 */
return 0; return 0;
} }