From b7a6d05399e8caf88a4d1dd9c1d37a52749fa75c Mon Sep 17 00:00:00 2001 From: kk134cv Date: Thu, 14 Mar 2019 22:05:33 +0100 Subject: [PATCH] final v --- program | Bin 5575 -> 6009 bytes program.c | 41 ++++++++++++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/program b/program index ee31e67bc4079d22b9ec77e0c47526c2cff87f7d..b7269c1db3d5c662a65b55cba46a197a699a8af3 100755 GIT binary patch literal 6009 zcmb7IYiyI(89sI#Fc2`e(f}E;HbY?|CZt@4&=TT=00u%xxs1Yx6FaeoZ?!+ur0N!! zlYtk4vWu#9KdMgCs%=#@q;(UbtTRmqrGG}5)S<1~m8kVATPzl#i&Yc}qT#g7z5@Kz6eU?9oWd>^i*ivWCZLJ36-S^0 zk_Ip;Mw<;(L>cgkqmYAU0h1`BZ;~vu1$ib3L885wuH>@qMaV!)VNeNTzm!|S8lm3^ z8EF`pL^=B)H9)@seUm)EBrR*aZu-yKg*bcMW+#-C6$O-nrkP z3}Hzd=3*j9m(iS|fqL{u|0L>BF7xLUPE=*vYg<0dvR+u$7l4_ld&c24<8WcWPRO>5 zlP?*E`K)2&l=02r%QB4iNGxh3O<%$^41v_OGG(iTv1vP6{h_FlN(TJU3ngQ%Yu6gd zR$sJD#8YNc#1o;Y*(M@~%upl%4I1Y?MSP*C*y!D~q1LE!uO6*cG90V?BUfYDf*Riq ziRJN7XezU~A9dL-u~oE7sSwpave_r#0UE(4A_2|hNc0|ZB>!o0$Pbbu>3(v&=%+H* zccyRH2I*$s(SaLtgy{YLe{;E9&tD#Qng_Zyw0}J$-GsvAHRD z^%x|>_}Q^5_(8YLKKMH*{HuRVIh}-gMI1lrkqOUQZw;J=C()BNKf}|eZ5=lTeagt<=zda3;i1UUy=W8^JG$qNf{Bjql2KrHbmtJNaxmG^{plzu zadcl-fPKwTeJ$w92WWG2Ul>)L;OJ)Fm6J)1?$<`a6i4^V3Lwxgq}r8=HFcoZ>++l_ z@A+g$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/program.c +++ b/program.c @@ -2,15 +2,34 @@ #include 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; +{ + int d = 0; + int m = 0; + int y = 0; + scanf("%d.%d.%d", &d, &m, &y); + + //check date validness + if(!(m>=1 && m<=12) && !(y>=0 && y<=9999) && !(((d>=1 && d<=31) && (m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12)) || ((d>=1 && d<=30) && m==4 || m==6 || m==9 || m==11) ||(d==29 && m==2 && (y%400==0 ||(y%4==0 && y%100!=0))) || ((d>=1 && d<=28) && m==2))){ + puts("Nespravny datum\n"); + return 0; + } + //setting date + struct tm t = { .tm_year=y-1900, .tm_mon=m-1, .tm_mday=d }; + //adding week to the date + t.tm_mday += 7; + mktime(&t); + + //output data + if(t.tm_mon+1 < 10){ + printf("%d.0%d.%d\n\n", t.tm_mday, t.tm_mon+1, t.tm_year+1900); + }else if(t.tm_mday <10 && t.tm_mon+1 < 10){ + printf(" %d.0%d.%d\n\n", t.tm_mday, t.tm_mon+1, t.tm_year+1900); + } + else if(t.tm_mday < 10){ + printf(" %d.%d.%d\n\n", t.tm_mday, t.tm_mon+1, t.tm_year+1900); + } + else{ + printf("%d.%d.%d\n\n", t.tm_mday, t.tm_mon+1, t.tm_year+1900); + } + }