2025-02-27 17:19:02 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#define VELKOST_POLA 50
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
int results[VELKOST_POLA];
|
|
|
|
memset(results, 0, VELKOST_POLA * sizeof(int));
|
|
|
|
|
|
|
|
int max_value = 0;
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
printf("Zadajte výsledky súťažiacich (max %d, ukončite nečíselným vstupom alebo EOF):\n", VELKOST_POLA);
|
|
|
|
|
|
|
|
for (int i = 0; i < VELKOST_POLA; i++) {
|
|
|
|
int temp;
|
|
|
|
if (scanf("%d", &temp) != 1 || temp < 1) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
results[i] = temp;
|
|
|
|
if (temp > max_value) {
|
|
|
|
max_value = temp;
|
|
|
|
}
|
|
|
|
count++;
|
2025-02-27 17:27:20 +00:00
|
|
|
if (getchar() != '_') {
|
|
|
|
break;
|
|
|
|
}
|
2025-02-27 17:19:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (count == 0) {
|
2025-02-27 17:27:20 +00:00
|
|
|
printf("Chyba:_Málo_platných_hodnôt.\n");
|
2025-02-27 17:19:02 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) {
|
2025-02-27 17:27:20 +00:00
|
|
|
printf("Súťažiaci_č._%d_vypil_%d_pohárov.\n", i + 1, results[i]);
|
2025-02-27 17:19:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
|
if (results[i] == max_value) {
|
2025-02-27 17:27:20 +00:00
|
|
|
printf("Výherca_je_súťažiaci_%d_ktorý_vypil_%d_pohárov.\n", i + 1, results[i]);
|
2025-02-27 17:19:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|