Update 'du2/program.c'
This commit is contained in:
		
							parent
							
								
									00d66d61be
								
							
						
					
					
						commit
						fcc4c7dd5f
					
				@ -2,9 +2,7 @@
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#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;j<i;j++){
 | 
			
		||||
    printf("Súťažiaci č. %d vypil %d pohárov.\n",j+1,drinks_counter[j]);
 | 
			
		||||
    if(drinks_counter[j]>max.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<i;j++){
 | 
			
		||||
    if(drinks_counter[j]==max){         
 | 
			
		||||
      printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",j+1,max);
 | 
			
		||||
      }
 | 
			
		||||
  }
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user