From d5b31d649a193a64194d6c3346e16dbba046212c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristi=C3=A1n=20Ruj=C3=A1k?= Date: Wed, 13 Mar 2019 22:45:13 +0000 Subject: [PATCH] Aktualizovat "program.c --- program.c | 92 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 50 insertions(+), 42 deletions(-) diff --git a/program.c b/program.c index 94d0c22..8677e0a 100644 --- a/program.c +++ b/program.c @@ -1,4 +1,4 @@ -#include + #include #include int main() @@ -8,48 +8,37 @@ int main() int d; int ko; scanf("%d.%d.%d", &d, &m, &y); - if(ko = 0){ - return 0;} if(y>=0 && y<=9999) { if(ko = 0){ return 0;} - if(ko = 0){ - return 0;} - - - - if(ko = 0){ - return 0;} + + + + + + + - if(ko = 0){ - return 0;} - if(ko = 0){ - return 0;} if(m>=1 && m<=12) { - if(ko = 0){ - return 0;} - if(ko = 0){ - return 0;} - if(ko = 0){ - return 0;} + + + if((d>=1 && d<=31) && (m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12)) {} - - @@ -59,7 +48,19 @@ int main() else if((d>=1 && d<=30) && m==4 || m==6 || m==9 || m==11) {} - + + + + + + + + + + + + + @@ -81,14 +82,12 @@ int main() - if(ko = 0){ - return 0;} - if(ko = 0){ - return 0;} + + @@ -98,15 +97,18 @@ int main() } } - if(ko = 0){ - return 0;} + else { printf("Nespravny datum\n"); - + + + + + @@ -114,12 +116,16 @@ int main() return 0; } - } if(ko = 0){ - return 0;} + } else { - + + + + + + printf("Nespravny datum\n"); @@ -127,21 +133,24 @@ int main() } + + + + + + struct tm t = { .tm_year=y-1900, .tm_mon=m-1, .tm_mday=d }; t.tm_mday += 7; mktime(&t); - if(ko = 0){ - return 0;} - - if(ko = 0){ - return 0;} + + + + - if(ko = 0){ - return 0;} @@ -186,5 +195,4 @@ int main() printf("%d.%d.%d\n\n", t.tm_mday, t.tm_mon+1, t.tm_year+1900); } -} - +} \ No newline at end of file