From fcc4c7dd5fbc618d37886cfdf718d0a7cf541699 Mon Sep 17 00:00:00 2001 From: Peter Sabol Date: Thu, 10 Mar 2022 19:37:38 +0000 Subject: [PATCH] Update 'du2/program.c' --- du2/program.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/du2/program.c b/du2/program.c index f2825a7..5a10bc6 100644 --- a/du2/program.c +++ b/du2/program.c @@ -2,9 +2,7 @@ #include #define VELKOST_POLA 52 -struct Winner{ - int drinks,position; -}; + int main(){ int drinks_counter[VELKOST_POLA]; @@ -16,14 +14,17 @@ int main(){ } i++; } - struct Winner max={0,0}; + int max=0; for(int j=0;jmax.drinks){ - max.drinks=drinks_counter[j]; - max.position=j+1; + if(drinks_counter[j]>max){ + max=drinks_counter[j]; } } - printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",max.position,max.drinks); + for(int j=0;j