Update 'du2/program.c'
This commit is contained in:
parent
740c929e72
commit
946effbbef
@ -1,11 +1,43 @@
|
||||
#include <stdio.h>
|
||||
#define VELKOST_POLA 50 // určiť veľkosť poľa
|
||||
|
||||
int main(){
|
||||
int outcome[VELKOST_POLA];
|
||||
memset(outcome, -1, VELKOST_POLA * sizeof(int)); // všetky pozície sú inicializované na 0
|
||||
int v = 0;
|
||||
int f = 0;
|
||||
int b = 0;
|
||||
int nacit = 0;
|
||||
int lepvys = 0; // požadované premenné
|
||||
int d[8];
|
||||
}
|
||||
|
||||
while(1){ //počet vypitých pohárov limonády účastníkmi
|
||||
int value = 0;
|
||||
int r = scanf("%d", value);
|
||||
if (r == 1){
|
||||
printf("Uspesne som nacital hodnotu %d\n", value);
|
||||
}
|
||||
else {
|
||||
printf("Nacitanie sa neporadilo. V premennej value ostala povodna hodnota. \n");
|
||||
int r = scanf("%d", &value);
|
||||
if (r == 1 && value > 0){
|
||||
outcome[f] = value; // Používam premennú na kontrolu, či som napočítal číslo väčšie ako 1
|
||||
if(v < outcome[f]{
|
||||
v = outcome[f];
|
||||
d[8] = f + 1;
|
||||
b = 0;
|
||||
}
|
||||
else if v == outcome[f]){
|
||||
if(b == 0){
|
||||
d[8] = f -1;
|
||||
b++;
|
||||
}
|
||||
d[8] = f;
|
||||
b++;
|
||||
}
|
||||
printf("Súťažiaci č. %d vypil %d pohárov.\n",i+1,results[i]);
|
||||
i++;
|
||||
}else if(f == 0){
|
||||
printf("Chyba: Málo platných hodnôt.\n");
|
||||
return 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user