diff --git a/program b/program new file mode 100755 index 0000000..ee31e67 Binary files /dev/null and b/program differ diff --git a/program.c b/program.c index 10b654f..817bd72 100644 --- a/program.c +++ b/program.c @@ -1,13 +1,16 @@ #include #include -int main(){ - //int day = 0; - //int mounth = 0; - //int year = 0; - //scanf("%d.%d.%d", &day, &mounth, &year); - time_t time; - scanf("%e.%m.%Y", &time); - printf("%e.%m.%Y", time); - return 0; +int main() +{ + /* initialize */ + int y=0, m=0, d=0; + fgets("%d.%d.%d", &d, &m, &y); + struct tm t = { .tm_year=y-1900, .tm_mon=m-1, .tm_mday=d }; + /* modify */ + t.tm_mday += 40; + mktime(&t); + /* show result */ + printf("%s", asctime(&t)); /* prints: Sun Mar 16 00:00:00 1980 */ + return 0; }