From 43d414250080faae2cefae96634ca52cc5f76531 Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Fri, 4 Mar 2022 13:54:31 +0100 Subject: [PATCH 01/21] funguje --- du1/program.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 du1/program.c diff --git a/du1/program.c b/du1/program.c new file mode 100644 index 0000000..8adfc91 --- /dev/null +++ b/du1/program.c @@ -0,0 +1,18 @@ +#include + + int main(){ + int counter=0, Sym; + char OutSym; + + while(1){ + Sym=getchar(); + if(Sym==EOF || Sym==0)break; + else if(Sym<='Z'&&Sym>='A')Sym +=32; + else if(Sym<='z'&&Sym>='a')Sym-=32; + counter++; + OutSym=Sym; + putchar(OutSym); +} + printf("\nPočet riadkov: %d\n",counter); + return 0; +} \ No newline at end of file From 042e637c4f8161a358289c38b2de4e6843a4c5c5 Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Fri, 4 Mar 2022 13:59:42 +0100 Subject: [PATCH 02/21] add file --- du1/program.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/du1/program.c b/du1/program.c index 8adfc91..e5e60db 100644 --- a/du1/program.c +++ b/du1/program.c @@ -5,14 +5,17 @@ char OutSym; while(1){ - Sym=getchar(); - if(Sym==EOF || Sym==0)break; - else if(Sym<='Z'&&Sym>='A')Sym +=32; - else if(Sym<='z'&&Sym>='a')Sym-=32; - counter++; - OutSym=Sym; - putchar(OutSym); -} + Sym=getchar(); + if(Sym==EOF || Sym==0){ + counter++; + break; + } + else if(Sym<='Z'&&Sym>='A')Sym +=32; + else if(Sym<='z'&&Sym>='a')Sym-=32; + //counter++; + OutSym=Sym; + putchar(OutSym); + } printf("\nPočet riadkov: %d\n",counter); return 0; } \ No newline at end of file From f88828014b4bfd5da6930b5d351b57768b9d1022 Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Fri, 4 Mar 2022 14:04:57 +0100 Subject: [PATCH 03/21] add file --- du1/program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/du1/program.c b/du1/program.c index e5e60db..13a5863 100644 --- a/du1/program.c +++ b/du1/program.c @@ -1,7 +1,7 @@ #include int main(){ - int counter=0, Sym; + int counter=1, Sym; char OutSym; while(1){ From 5b551900e6cac52350a2cd5fe82dd11afbda1cef Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Fri, 4 Mar 2022 14:08:02 +0100 Subject: [PATCH 04/21] add file --- du1/program.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/du1/program.c b/du1/program.c index 13a5863..9fd2828 100644 --- a/du1/program.c +++ b/du1/program.c @@ -1,12 +1,15 @@ #include int main(){ - int counter=1, Sym; + int counter=0, Sym; char OutSym; while(1){ Sym=getchar(); - if(Sym==EOF || Sym==0){ + if(Sym==0){ + counter++; + } + if(Sym==EOF){ counter++; break; } From a581bacd64fdc2d957d6cc5bc2ed690958e50301 Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Fri, 4 Mar 2022 14:10:25 +0100 Subject: [PATCH 05/21] add file --- du1/program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/du1/program.c b/du1/program.c index 9fd2828..b746cc7 100644 --- a/du1/program.c +++ b/du1/program.c @@ -6,7 +6,7 @@ while(1){ Sym=getchar(); - if(Sym==0){ + if(Sym==0||Sym=='\n'){ counter++; } if(Sym==EOF){ From 75271efd812a21b658b0754ab30cbbcaed5ffd77 Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Fri, 4 Mar 2022 14:11:52 +0100 Subject: [PATCH 06/21] add file --- du1/program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/du1/program.c b/du1/program.c index b746cc7..8cc3d19 100644 --- a/du1/program.c +++ b/du1/program.c @@ -10,7 +10,7 @@ counter++; } if(Sym==EOF){ - counter++; + //counter++; break; } else if(Sym<='Z'&&Sym>='A')Sym +=32; From da4409830f7297838622d239c3937272b80947ef Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Fri, 4 Mar 2022 14:14:31 +0100 Subject: [PATCH 07/21] add file --- du1/program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/du1/program.c b/du1/program.c index 8cc3d19..0fd4159 100644 --- a/du1/program.c +++ b/du1/program.c @@ -6,7 +6,7 @@ while(1){ Sym=getchar(); - if(Sym==0||Sym=='\n'){ + if(Sym=='\n'){ counter++; } if(Sym==EOF){ From 5ed55cd17aee703a19599088ef5590f3f59f8406 Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Thu, 10 Mar 2022 18:15:54 +0100 Subject: [PATCH 08/21] funguje --- du2/program.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 du2/program.c diff --git a/du2/program.c b/du2/program.c new file mode 100644 index 0000000..6a6418d --- /dev/null +++ b/du2/program.c @@ -0,0 +1,38 @@ +#include +#include +#define VELKOST_POLA 12 + + +int main(){ + + int value = 0; + + int pole[VELKOST_POLA]; + memset(pole,0,VELKOST_POLA*(sizeof(int))); + + int idx=0; + while (1){ + int r=scanf("%d",&value); + if(r!=1||idx==VELKOST_POLA){ + break; + } + pole[idx]=value; + idx++; + value++; + } + + if (value==0){ + printf("Error\n"); + return 0; + } + + int max_hodnota=0; + for(int i=0; i max_hodnota){ + max_hodnota = pole[i]; + } + } + printf("%d\n", max_hodnota); + + return 0; +} From eff25efc5809d57408d4db0f8fe8e6904618b36b Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Thu, 10 Mar 2022 18:24:43 +0100 Subject: [PATCH 09/21] funguje --- du2/program.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/du2/program.c b/du2/program.c index 6a6418d..f1755ad 100644 --- a/du2/program.c +++ b/du2/program.c @@ -10,6 +10,8 @@ int main(){ int pole[VELKOST_POLA]; memset(pole,0,VELKOST_POLA*(sizeof(int))); + + int max_hodnota=0; int idx=0; while (1){ int r=scanf("%d",&value); @@ -17,6 +19,9 @@ int main(){ break; } pole[idx]=value; + if (pole[idx] > max_hodnota){ + max_hodnota = pole[i]; + } idx++; value++; } @@ -26,13 +31,12 @@ int main(){ return 0; } - int max_hodnota=0; - for(int i=0; i max_hodnota){ - max_hodnota = pole[i]; - } + for(int i=0; i Date: Thu, 10 Mar 2022 18:26:26 +0100 Subject: [PATCH 10/21] funguje --- du2/program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/du2/program.c b/du2/program.c index f1755ad..ecb7548 100644 --- a/du2/program.c +++ b/du2/program.c @@ -20,7 +20,7 @@ int main(){ } pole[idx]=value; if (pole[idx] > max_hodnota){ - max_hodnota = pole[i]; + max_hodnota = pole[idx]; } idx++; value++; From a8ff203397a2c04631acb9562f96678faf9b8e28 Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Thu, 10 Mar 2022 18:27:08 +0100 Subject: [PATCH 11/21] funguje --- du2/program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/du2/program.c b/du2/program.c index ecb7548..5d4e1f6 100644 --- a/du2/program.c +++ b/du2/program.c @@ -32,7 +32,7 @@ int main(){ } for(int i=0; i Date: Thu, 10 Mar 2022 18:28:41 +0100 Subject: [PATCH 12/21] funguje --- du2/program.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/du2/program.c b/du2/program.c index 5d4e1f6..61b07ee 100644 --- a/du2/program.c +++ b/du2/program.c @@ -32,7 +32,9 @@ int main(){ } for(int i=0; i0){ + printf("Súťažiaci č. %d vypil %d pohárov.\n", i, pole[i]); + } } From 550979778e77495e3b9f4dc77dc6af318dd081ac Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Thu, 10 Mar 2022 18:32:31 +0100 Subject: [PATCH 13/21] funguje --- du2/program.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/du2/program.c b/du2/program.c index 61b07ee..b0088e6 100644 --- a/du2/program.c +++ b/du2/program.c @@ -9,7 +9,7 @@ int main(){ int pole[VELKOST_POLA]; memset(pole,0,VELKOST_POLA*(sizeof(int))); - + int max=0; int max_hodnota=0; int idx=0; @@ -20,6 +20,7 @@ int main(){ } pole[idx]=value; if (pole[idx] > max_hodnota){ + max=idx; max_hodnota = pole[idx]; } idx++; @@ -33,12 +34,12 @@ int main(){ for(int i=0; i0){ - printf("Súťažiaci č. %d vypil %d pohárov.\n", i, pole[i]); + printf("Súťažiaci č. %d vypil %d pohárov.\n", i+1, pole[i]); } } - //printf("%d\n", max_hodnota); + printf("Súťažiaci č. %d vypil %d pohárov.\n",max+1, max_hodnota); return 0; } From a31f1f1fba541131b939edea3a8f3a07cf62a9ce Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Thu, 10 Mar 2022 18:34:21 +0100 Subject: [PATCH 14/21] funguje --- du2/program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/du2/program.c b/du2/program.c index b0088e6..35a92f3 100644 --- a/du2/program.c +++ b/du2/program.c @@ -39,7 +39,7 @@ int main(){ } - printf("Súťažiaci č. %d vypil %d pohárov.\n",max+1, max_hodnota); + printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",max+1, max_hodnota); return 0; } From 72d32db934729bd54deeef21bc585b21ebf1d55c Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Thu, 10 Mar 2022 18:36:51 +0100 Subject: [PATCH 15/21] funguje --- du2/program.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/du2/program.c b/du2/program.c index 35a92f3..4c74ba4 100644 --- a/du2/program.c +++ b/du2/program.c @@ -9,7 +9,6 @@ int main(){ int pole[VELKOST_POLA]; memset(pole,0,VELKOST_POLA*(sizeof(int))); - int max=0; int max_hodnota=0; int idx=0; @@ -38,8 +37,11 @@ int main(){ } } - - printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",max+1, max_hodnota); + for(int i=0; i Date: Thu, 10 Mar 2022 18:37:21 +0100 Subject: [PATCH 16/21] funguje --- du2/program.c | 1 - 1 file changed, 1 deletion(-) diff --git a/du2/program.c b/du2/program.c index 4c74ba4..c525126 100644 --- a/du2/program.c +++ b/du2/program.c @@ -19,7 +19,6 @@ int main(){ } pole[idx]=value; if (pole[idx] > max_hodnota){ - max=idx; max_hodnota = pole[idx]; } idx++; From 10e2081a822ce16e07b875dcbfce34c781f439a0 Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Thu, 10 Mar 2022 18:38:23 +0100 Subject: [PATCH 17/21] funguje --- du2/program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/du2/program.c b/du2/program.c index c525126..c8c7ef4 100644 --- a/du2/program.c +++ b/du2/program.c @@ -1,6 +1,6 @@ #include #include -#define VELKOST_POLA 12 +#define VELKOST_POLA 90 int main(){ From 16fc5d48036073cdf80b177ca50b564754d367ec Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Thu, 10 Mar 2022 18:46:13 +0100 Subject: [PATCH 18/21] funguje --- du2/program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/du2/program.c b/du2/program.c index c8c7ef4..819886d 100644 --- a/du2/program.c +++ b/du2/program.c @@ -14,7 +14,7 @@ int main(){ int idx=0; while (1){ int r=scanf("%d",&value); - if(r!=1||idx==VELKOST_POLA){ + if(r!=1||idx==VELKOST_POLA||pole[idx]<0){ break; } pole[idx]=value; From 881308c10e5dd9892960727804846cffe25134b5 Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Thu, 10 Mar 2022 18:48:25 +0100 Subject: [PATCH 19/21] funguje --- du2/program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/du2/program.c b/du2/program.c index 819886d..8a03c45 100644 --- a/du2/program.c +++ b/du2/program.c @@ -14,7 +14,7 @@ int main(){ int idx=0; while (1){ int r=scanf("%d",&value); - if(r!=1||idx==VELKOST_POLA||pole[idx]<0){ + if(r!=1 || idx==VELKOST_POLA || value < 0){ break; } pole[idx]=value; From 7233a5de71d2967a56ee2d4f70f81ed04cec82bd Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Thu, 10 Mar 2022 18:50:57 +0100 Subject: [PATCH 20/21] funguje --- du2/program.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/du2/program.c b/du2/program.c index 8a03c45..099889b 100644 --- a/du2/program.c +++ b/du2/program.c @@ -6,6 +6,7 @@ int main(){ int value = 0; + int count = 0; int pole[VELKOST_POLA]; memset(pole,0,VELKOST_POLA*(sizeof(int))); @@ -22,11 +23,11 @@ int main(){ max_hodnota = pole[idx]; } idx++; - value++; + count++; } if (value==0){ - printf("Error\n"); + printf("Chyba: Málo platných hodnôt.\n"); return 0; } From fe19e3efa616e0dc592aef03ab7078b206b9497d Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Thu, 10 Mar 2022 18:51:43 +0100 Subject: [PATCH 21/21] funguje --- du2/program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/du2/program.c b/du2/program.c index 099889b..85e879a 100644 --- a/du2/program.c +++ b/du2/program.c @@ -26,7 +26,7 @@ int main(){ count++; } - if (value==0){ + if (count==0){ printf("Chyba: Málo platných hodnôt.\n"); return 0; }