cv2
This commit is contained in:
parent
5c95fb1b98
commit
2a7fc3017b
56
cv2/program.c
Normal file
56
cv2/program.c
Normal file
@ -0,0 +1,56 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
int results[50];
|
||||
int count = 0;
|
||||
int max = 0;
|
||||
|
||||
printf("Zadajte výsledky súťažiacich s medzerami(max. 50): \n" );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
while (count < 50 && scanf ("%d", &results[count]) == 1){
|
||||
|
||||
if (results[count] == EOF){
|
||||
break;
|
||||
}
|
||||
|
||||
if (results[count] < 1){
|
||||
printf("neplatna hodnota. \n");
|
||||
return 1;
|
||||
}
|
||||
count++;
|
||||
|
||||
if (count == 0){
|
||||
printf ("chyba\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
int vyhercovia[50];
|
||||
int vyherca = 0 ;
|
||||
|
||||
for ( int i = 0; i < count; i++){
|
||||
printf("Súťažiaci č. %d vypil %d pohárov.\n",i+1,results[i]);
|
||||
}
|
||||
for (int i = 0; i < count; i++){
|
||||
if (results[i] > max ) {
|
||||
max = results[i];
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < count; i++){
|
||||
if (results[i] == max ) {
|
||||
vyherca++;
|
||||
vyhercovia[index] = i+1;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < vyherca; i++){
|
||||
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",vyhercovia[i],max);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
BIN
cv2/program.exe
Normal file
BIN
cv2/program.exe
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user