submition2

This commit is contained in:
kr820js 2024-02-25 17:43:21 +01:00
parent 342cba6001
commit e481c6ae97

View File

@ -16,32 +16,50 @@ int main(){
printf("ERROR");
}
for(int j=0; j<i; j++){
printf("%d",array_of_winers[j]);
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",array_of_winers[j]+1,pole[array_of_winers[j]]);
}
}
int array_of_quontiti_of_drinked_limonades(int *pole,int *array_of_winers){
int i=0;
int value = 0;
int value[VELKOST_POLA * sizeof(int)];
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++;
int readed_quantity=reading_input(pole);
int winners_index=0;
for(int i=0; i<readed_quantity; i++){
printf("Súťažiaci č. %d vypil %d pohárov.\n",i+1,pole[i]);
if(pole[i]>bigest_score){
bigest_score=pole[i];
j=0;
winners_index=0;
}
if(pole[i]==bigest_score){
array_of_winers[j]=i;
array_of_winers[winners_index]=i;
winners_index++;
}
}
return winners_index;
}
int reading_input(int *pole){
char array_of_symbols[99];
int i=0;
int j=0;
char c;
while ((c = getchar()) != EOF) {
if (c!='\n' && c!=' ' && c!='\t' && (c > '9' || c < '0')){
break;
}
if(c >= '0' && c <='9'){
array_of_symbols[i]=c;
i++;
} else{
array_of_symbols[i]='\0';
if(i!=0){
pole[j]=atoi(array_of_symbols);
i=0;
j++;
}
i++;
}else{
break;
}
}
return j;