aolkfdlaa
This commit is contained in:
parent
34be7bad83
commit
381896727e
@ -9,14 +9,29 @@ int main() {
|
|||||||
int max_value = 0;
|
int max_value = 0;
|
||||||
int value_count = 0;
|
int value_count = 0;
|
||||||
|
|
||||||
for (int i = 0; i < MAX_COUNT; i++) {
|
|
||||||
|
int first_read = scanf("%d", &results[0]);
|
||||||
|
if (first_read != 1) {
|
||||||
|
printf("Chyba: Málo platných hodnôt.\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (results[0] < 0) {
|
||||||
|
printf("Chyba: Málo platných hodnôt.\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
value_count = 1;
|
||||||
|
max_value = results[0];
|
||||||
|
printf("Súťažiaci č. 1 vypil %d pohárov.\n", results[0]);
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 1; i < MAX_COUNT; i++) {
|
||||||
int r = scanf("%d", &results[i]);
|
int r = scanf("%d", &results[i]);
|
||||||
if (r == 1) {
|
if (r == 1) {
|
||||||
if (results[i] < 0) {
|
if (results[i] < 0) {
|
||||||
if (i == 0) {
|
|
||||||
printf("Chyba: Málo platných hodnôt.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
value_count++;
|
value_count++;
|
||||||
@ -29,11 +44,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value_count == 0) {
|
|
||||||
printf("Žiadne hodnoty neboli načítané.\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < value_count; i++) {
|
for (int i = 0; i < value_count; i++) {
|
||||||
if (results[i] == max_value) {
|
if (results[i] == max_value) {
|
||||||
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",
|
||||||
@ -41,5 +52,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user