2024-02-27 14:10:58 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
int results[50], count = 0, num, maxPoharov = 0;
|
|
|
|
|
2024-02-29 09:24:04 +00:00
|
|
|
while (scanf("%d", &num) == 1) {
|
|
|
|
if (num < 1) {
|
|
|
|
printf("Chyba: Neplatné číslo %d. Prosím, zadajte kladné číslo.\n", num);
|
2024-02-29 09:26:37 +00:00
|
|
|
|
|
|
|
break;
|
2024-02-29 09:24:04 +00:00
|
|
|
}
|
|
|
|
if (count >= 50) {
|
2024-02-29 09:26:37 +00:00
|
|
|
|
2024-02-29 09:24:04 +00:00
|
|
|
printf("Upozornenie: Dosiahnutý maximálny počet záznamov.\n");
|
|
|
|
break;
|
2024-02-27 14:10:58 +00:00
|
|
|
}
|
|
|
|
results[count++] = num;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (count == 0) {
|
|
|
|
printf("Chyba: Málo platných hodnôt.\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
|
printf("Súťažiaci č. %d vypil %d pohárov.\n", i + 1, results[i]);
|
|
|
|
if (results[i] > maxPoharov) {
|
|
|
|
maxPoharov = results[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-29 09:26:37 +00:00
|
|
|
|
2024-02-27 14:10:58 +00:00
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
|
if (results[i] == maxPoharov) {
|
2024-02-29 09:22:06 +00:00
|
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", i + 1, maxPoharov);
|
2024-02-29 09:26:37 +00:00
|
|
|
break;
|
2024-02-27 14:10:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|