du1
This commit is contained in:
parent
ccb415a4eb
commit
06a80b6a93
@ -14,7 +14,7 @@ int main() {
|
|||||||
|
|
||||||
while (scanf("%d", &value) == 1 && value > 0) {
|
while (scanf("%d", &value) == 1 && value > 0) {
|
||||||
if (index >= ARRAY_SIZE) {
|
if (index >= ARRAY_SIZE) {
|
||||||
fprintf(stderr, "Error: Too many competitors!\n");
|
fprintf(stderr, "Chyba: Príliš veľa súťažiacich!\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
results[index] = value;
|
results[index] = value;
|
||||||
@ -25,14 +25,18 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
printf("No valid data were entered.\n");
|
printf("Neboli načítané žiadne platné údaje.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Competitors with the highest number of drinks:\n");
|
for (int i = 0; i < index; i++) {
|
||||||
|
printf("Súťažiaci č. %d vypil %d pohárov.\n", i + 1, results[i]);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < index; i++) {
|
for (int i = 0; i < index; i++) {
|
||||||
if (results[i] == max_value) {
|
if (results[i] == max_value) {
|
||||||
printf("%d\n", i);
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", i + 1, max_value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user