From c98475792c4aeb8878e78c45fa5ca0b0737c2b5e Mon Sep 17 00:00:00 2001 From: Peter Sabol Date: Thu, 10 Mar 2022 20:23:56 +0100 Subject: [PATCH] funguje --- du2/program.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/du2/program.c b/du2/program.c index 91fabf0..1b5d64d 100644 --- a/du2/program.c +++ b/du2/program.c @@ -2,19 +2,28 @@ #include #define VELKOST_POLA 52 +struct Winner{ + int drinks,position; +}; + int main(){ - int vysledky[VELKOST_POLA]; - int pocet; - int max=0; - int i=0; - char pole[50]; - memset(pole,0,VELKOST_POLA * sizeof(int)); - for(i max){ - max = pole[i]; - } - printf("\nSúťažiaci č.%d vypil %d pohárov.\n", i , pole[i]); + int drinks_counter[VELKOST_POLA]; + int i=0; + while(imax.drinks){ + max.drinks=drinks_counter[j]; + max.position=j; + } + } + printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",max.position,max.drinks); return 0; } \ No newline at end of file