From 4877ba1c9df878a363140c9f09ce184f99bad617 Mon Sep 17 00:00:00 2001 From: Artem Horbunov Date: Thu, 26 Mar 2020 22:06:43 +0000 Subject: [PATCH 01/12] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu3/program.c?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du3/program.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/du3/program.c b/du3/program.c index e69de29..1d6a8e8 100644 --- a/du3/program.c +++ b/du3/program.c @@ -0,0 +1,59 @@ +#include + +int main(){ + int day; + int month; + int year; + scanf("%d.%d.%d", &day, &month, &year); + if(day < 1 || day > 31 || month < 1 || month > 12){ + puts("Neplatny datum"); + return 0; + } + if(month == 2 && day > 29){ + puts("Neplatny datum"); + return 0; + } + if(year % 4 != 0 && month == 2 && day > 28){ + puts("Neplatny datum"); + return 0; + } + if(month == 4 || month == 6 || month == 9 || month == 11 && day > 30){ + puts("Neplatny datum"); + return 0; + } + + day += 7; + if(year % 4 != 0 && month == 2 && day > 28){ + month++; + day -= 28; + } + else if(month == 2 && day > 29){ + month++; + day -= 29; + } + else if(month == 4 && month == 6 && month == 9 && month == 11 && day > 30){ + month++; + day -= 30; + } + else if(day > 31){ + month++; + day -= 31; + } + if(month == 13){ + month = 1; + year++; + } + + if(month < 10 && day < 10){ + printf("0%d.0%d.%d\n", day, month, year); + } + else if(month < 10){ + printf("%d.0%d.%d\n", day, month, year); + } + else if(day < 10){ + printf("0%d.%d.%d\n", day, month, year); + } + else{ + printf("%d.%d.%d\n", day, month, year); + } +} \ No newline at end of file From e5430ce0938e63c11d084b96f509d10851e4c794 Mon Sep 17 00:00:00 2001 From: Artem Horbunov Date: Thu, 26 Mar 2020 22:21:14 +0000 Subject: [PATCH 02/12] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu3/program.c?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du3/program.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/du3/program.c b/du3/program.c index 1d6a8e8..433b703 100644 --- a/du3/program.c +++ b/du3/program.c @@ -50,10 +50,7 @@ int main(){ else if(month < 10){ printf("%d.0%d.%d\n", day, month, year); } - else if(day < 10){ - printf("0%d.%d.%d\n", day, month, year); - } else{ printf("%d.%d.%d\n", day, month, year); } -} \ No newline at end of file +} From d9f60a0638741673180c4fbb7ae11f341b5224dc Mon Sep 17 00:00:00 2001 From: Artem Horbunov Date: Thu, 26 Mar 2020 22:22:24 +0000 Subject: [PATCH 03/12] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu3/program.c?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 067984d7dc225cd7ec960edca30a2a9ed355ab9c Mon Sep 17 00:00:00 2001 From: Artem Horbunov Date: Thu, 26 Mar 2020 22:27:29 +0000 Subject: [PATCH 04/12] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu3/program.c?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du3/program.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/du3/program.c b/du3/program.c index 433b703..bacba05 100644 --- a/du3/program.c +++ b/du3/program.c @@ -44,9 +44,6 @@ int main(){ year++; } - if(month < 10 && day < 10){ - printf("0%d.0%d.%d\n", day, month, year); - } else if(month < 10){ printf("%d.0%d.%d\n", day, month, year); } From d7ed1c2d95ed432c95834470e9ed6334f8e053fc Mon Sep 17 00:00:00 2001 From: Artem Horbunov Date: Thu, 26 Mar 2020 22:37:39 +0000 Subject: [PATCH 05/12] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu3/program.c?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du3/program.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/du3/program.c b/du3/program.c index bacba05..e8a67a7 100644 --- a/du3/program.c +++ b/du3/program.c @@ -44,10 +44,16 @@ int main(){ year++; } + if(month < 10 && day < 10){ + printf("_%d.0%d.%d\n", day, month, year); + } else if(month < 10){ printf("%d.0%d.%d\n", day, month, year); } + else if(day < 10){ + printf("_%d.%d.%d\n", day, month, year); + } else{ printf("%d.%d.%d\n", day, month, year); } -} +} \ No newline at end of file From 35160c3443a9ec178380f607f0d5657ee28a155b Mon Sep 17 00:00:00 2001 From: Artem Horbunov Date: Thu, 26 Mar 2020 22:42:04 +0000 Subject: [PATCH 06/12] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu3/program.c?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du3/program.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/du3/program.c b/du3/program.c index e8a67a7..9af9c86 100644 --- a/du3/program.c +++ b/du3/program.c @@ -45,13 +45,13 @@ int main(){ } if(month < 10 && day < 10){ - printf("_%d.0%d.%d\n", day, month, year); + printf("␣%d.0%d.%d\n", day, month, year); } else if(month < 10){ printf("%d.0%d.%d\n", day, month, year); } else if(day < 10){ - printf("_%d.%d.%d\n", day, month, year); + printf("␣%d.%d.%d\n", day, month, year); } else{ printf("%d.%d.%d\n", day, month, year); From ebc411d1f9f865384d61c1e7ce8417597524d570 Mon Sep 17 00:00:00 2001 From: Artem Horbunov Date: Thu, 26 Mar 2020 22:43:05 +0000 Subject: [PATCH 07/12] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu3/program.c?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From e5d9ccafd44425d1a9141c2b1adfbcc9ab5cf957 Mon Sep 17 00:00:00 2001 From: Artem Horbunov Date: Thu, 26 Mar 2020 22:46:29 +0000 Subject: [PATCH 08/12] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu3/program.c?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du3/program.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/du3/program.c b/du3/program.c index 9af9c86..077a996 100644 --- a/du3/program.c +++ b/du3/program.c @@ -45,15 +45,15 @@ int main(){ } if(month < 10 && day < 10){ - printf("␣%d.0%d.%d\n", day, month, year); + printf("␣%d.0%d.%d\n\n", day, month, year); } else if(month < 10){ - printf("%d.0%d.%d\n", day, month, year); + printf("%d.0%d.%d\n\n", day, month, year); } else if(day < 10){ - printf("␣%d.%d.%d\n", day, month, year); + printf("␣%d.%d.%d\n\n", day, month, year); } else{ - printf("%d.%d.%d\n", day, month, year); + printf("%d.%d.%d\n\n", day, month, year); } } \ No newline at end of file From 28561962b3fe4ac0c74715e1705192b4db71a631 Mon Sep 17 00:00:00 2001 From: Artem Horbunov Date: Thu, 26 Mar 2020 22:51:35 +0000 Subject: [PATCH 09/12] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu3/program.c?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du3/program.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/du3/program.c b/du3/program.c index 077a996..762247b 100644 --- a/du3/program.c +++ b/du3/program.c @@ -45,13 +45,13 @@ int main(){ } if(month < 10 && day < 10){ - printf("␣%d.0%d.%d\n\n", day, month, year); + printf(" %d.0%d.%d\n\n", day, month, year); } else if(month < 10){ printf("%d.0%d.%d\n\n", day, month, year); } else if(day < 10){ - printf("␣%d.%d.%d\n\n", day, month, year); + printf(" %d.%d.%d\n\n", day, month, year); } else{ printf("%d.%d.%d\n\n", day, month, year); From df9811c3e9aac8d33735c82ed3e40aff91f87bb5 Mon Sep 17 00:00:00 2001 From: Artem Horbunov Date: Thu, 26 Mar 2020 22:58:22 +0000 Subject: [PATCH 10/12] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu3/program.c?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du3/program.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/du3/program.c b/du3/program.c index 762247b..e4d61e9 100644 --- a/du3/program.c +++ b/du3/program.c @@ -17,9 +17,11 @@ int main(){ puts("Neplatny datum"); return 0; } - if(month == 4 || month == 6 || month == 9 || month == 11 && day > 30){ + if(month == 4 || month == 6 || month == 9 || month == 11){ +if(day > 30){ puts("Neplatny datum"); return 0; +} } day += 7; @@ -31,9 +33,11 @@ int main(){ month++; day -= 29; } - else if(month == 4 && month == 6 && month == 9 && month == 11 && day > 30){ + else if(month == 4 || month == 6 || month == 9 || month == 11){ +if(day > 30){ month++; day -= 30; +} } else if(day > 31){ month++; @@ -56,4 +60,4 @@ int main(){ else{ printf("%d.%d.%d\n\n", day, month, year); } -} \ No newline at end of file +} From 701a9fb030a0c724d3b6aea5368aa81854d44ae9 Mon Sep 17 00:00:00 2001 From: Artem Horbunov Date: Thu, 26 Mar 2020 23:01:20 +0000 Subject: [PATCH 11/12] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu3/program.c?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du3/program.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/du3/program.c b/du3/program.c index e4d61e9..c274ab5 100644 --- a/du3/program.c +++ b/du3/program.c @@ -6,20 +6,20 @@ int main(){ int year; scanf("%d.%d.%d", &day, &month, &year); if(day < 1 || day > 31 || month < 1 || month > 12){ - puts("Neplatny datum"); + puts("Nespravny datum"); return 0; } if(month == 2 && day > 29){ - puts("Neplatny datum"); + puts("Nespravny datum"); return 0; } if(year % 4 != 0 && month == 2 && day > 28){ - puts("Neplatny datum"); + puts("Nespravny datum"); return 0; } if(month == 4 || month == 6 || month == 9 || month == 11){ if(day > 30){ - puts("Neplatny datum"); + puts("Nespravny datum"); return 0; } } From 652d03d9d40852382b55cb2c3012f7167dfa0a3b Mon Sep 17 00:00:00 2001 From: Artem Horbunov Date: Thu, 26 Mar 2020 23:06:58 +0000 Subject: [PATCH 12/12] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu3/program.c?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du3/program.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/du3/program.c b/du3/program.c index c274ab5..af0090a 100644 --- a/du3/program.c +++ b/du3/program.c @@ -5,7 +5,7 @@ int main(){ int month; int year; scanf("%d.%d.%d", &day, &month, &year); - if(day < 1 || day > 31 || month < 1 || month > 12){ + if(day < 1 || day > 31 || month < 1 || month > 12 || year < 0){ puts("Nespravny datum"); return 0; } @@ -60,4 +60,4 @@ if(day > 30){ else{ printf("%d.%d.%d\n\n", day, month, year); } -} +} \ No newline at end of file