diff --git a/du2/.program.c.swl b/du2/.program.c.swl new file mode 100644 index 0000000..ee5b49d Binary files /dev/null and b/du2/.program.c.swl differ diff --git a/du2/.program.c.swm b/du2/.program.c.swm new file mode 100644 index 0000000..0339d09 Binary files /dev/null and b/du2/.program.c.swm differ diff --git a/du2/.program.c.swn b/du2/.program.c.swn new file mode 100644 index 0000000..387c26b Binary files /dev/null and b/du2/.program.c.swn differ diff --git a/du2/.program.c.swo b/du2/.program.c.swo new file mode 100644 index 0000000..47d4f50 Binary files /dev/null and b/du2/.program.c.swo differ diff --git a/du2/program b/du2/program index b366fc7..bd1f49d 100755 Binary files a/du2/program and b/du2/program differ diff --git a/du2/program.c b/du2/program.c index 7ebca92..97e811c 100644 --- a/du2/program.c +++ b/du2/program.c @@ -1,19 +1,33 @@ #include -#define VELKOST_POLA 52 +#define VELKOST_POLA 50 int main(){ - int results[50]; + int results[VELKOST_POLA]; int max; - int vysledky[VELKOST_POLA] = {0,0,0,0}; + //int value = 0; int i = 0; - printf("1 2 3 4 5"); + int a = 0; while(1){ - scanf("%d", results[i]); - if(results[i] == 1) - printf("Úspešne som načítal hodnotu %d\n",results[i]); - else - printf("Načítanie sa nepodarilo. V premennej value ostala pôvodná hodnota. \n"); - i++; - } + int value = 0; + int r = scanf("%d",&value); + if (r == 1){ + printf("Úspešne som načítal hodnotu %d\n",value); + results[i] = value; + max = results[0]; + if(max < results[i]) + max = results[i]; + i++; + }else{ + do{ + printf("Súťažiaci č. %d vypil %d pohárovav.\n", results[a], results[a]); + if(a == i - 1){ + printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", max, max); + break; + } + a++; + }while(a < i); + break; + } + } return 0; }