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