pvjc24/cv2/program.c
2024-02-25 16:15:04 +01:00

50 lines
1.3 KiB
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#define VELKOST_POLA 12
int array_of_quontiti_of_drinked_limonades(int *pole,int *array_of_winers);
int main(){
int pole[VELKOST_POLA];
memset(pole,0,VELKOST_POLA * sizeof(int));
int array_of_winers[VELKOST_POLA];
memset(array_of_winers,0,VELKOST_POLA * sizeof(int));
int i=array_of_quontiti_of_drinked_limonades(pole,array_of_winers);
if(i==0){
printf("ERROR");
}
for(int j=0; j<i; j++){
printf("%d",array_of_winers[j]);
}
}
int array_of_quontiti_of_drinked_limonades(int *pole,int *array_of_winers){
int i=0;
int value = 0;
int bigest_score=0;
int counter_of_rided_values=0;
int j=0;
while(true){
int r = scanf("%d",&value);
if (r == 1&&value>0){
pole[i]=value;
counter_of_rided_values++;
if(pole[i]>bigest_score){
bigest_score=pole[i];
j=0;
}
if(pole[i]==bigest_score){
array_of_winers[j]=i;
j++;
}
i++;
}else{
break;
}
}
return j;
}