Изменить 'du2/program.c'
uh
This commit is contained in:
parent
b540e4eaba
commit
5eefe5721d
@ -25,7 +25,9 @@ int main() {
|
||||
int final_count = 0;
|
||||
int numbers[50];
|
||||
int max_number = 0;
|
||||
int max_position = 1;
|
||||
int max_positions[50];
|
||||
int repeats = 1;
|
||||
int user = 1;
|
||||
|
||||
fgets(glass, 500, stdin);
|
||||
|
||||
@ -49,18 +51,24 @@ int main() {
|
||||
}
|
||||
else if (max_number < numbers[counter2-1]){
|
||||
max_number = numbers[counter2-1];
|
||||
repeats = 1;
|
||||
max_positions[repeats-1] = user;
|
||||
//max_position = i+1;
|
||||
}
|
||||
printf("Súťažiaci č. %d vypil %d pohárov.\n",max_position,numbers[counter2-1]);
|
||||
else if (max_number == numbers [counter2-1]){
|
||||
repeats++;
|
||||
max_positions[repeats-1] = user;
|
||||
}
|
||||
|
||||
printf("Súťažiaci č. %d vypil %d pohárov.\n",user,numbers[counter2-1]);
|
||||
//max_position = i+1;
|
||||
counter = 0;
|
||||
memset(divided, '\0', 10);
|
||||
max_position++;
|
||||
user++;
|
||||
}
|
||||
|
||||
final_count = i;
|
||||
if(glass[i] == '\n'){
|
||||
max_position--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -68,7 +76,8 @@ int main() {
|
||||
if (final_count == 0)
|
||||
printf("Chyba: Málo platných hodnôt.\n");
|
||||
else {
|
||||
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",max_position,max_number);
|
||||
for(int i = 0; i < repeats; i++)
|
||||
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",max_position,max_number);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user