From 6d360370d831f515e3ec93df5f35a0426fd05d2d Mon Sep 17 00:00:00 2001 From: Peter Petrek Date: Fri, 3 Dec 2021 00:16:09 +0100 Subject: [PATCH] try --- a4/program.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/a4/program.c b/a4/program.c index 5f3b0db..5c91ef4 100644 --- a/a4/program.c +++ b/a4/program.c @@ -20,7 +20,7 @@ int main(){ int vypis[100]; if(jeKopa(i,inputNum)){ printf("Je to taka kopa:"); - //int temp = 0, count = 0; + int temp = 0, count = 0; vypis[0] = 0; for (int j = 0; j+1 < i; j++) @@ -30,16 +30,16 @@ int main(){ break; } vypis[j+1] = 2*j+1; - vypis[i-(j+1)] = 2*j+2; + vypis[i-(j)] = 2*j+2; } - if (i%2==0) + if (i%2!=0) { - vypis[i/2] = inputNum[i-1]; + vypis[(i/2)+1] = i; } } printf("\n"); - vypisovac(vypis,inputNum,i); + vypisovac(vypis,inputNum,i+1); return 0; } @@ -51,7 +51,7 @@ bool jeKopa(int i, int inputNum[SIZE]){ { continue; } - if ((inputNum[j]>inputNum[l]) || (inputNum[j]>inputNum[r])) + if (inputNum[j]>inputNum[l] || inputNum[j]>inputNum[r]) { printf("Nieje kopa"); return 0; @@ -65,7 +65,7 @@ void vypisovac(int vypis[SIZE], int input[SIZE], int size){ int counter = 0, count = ownPow(2,0), space = 0, i = 0; for (i = 0; i < size; i++) { - if (counter>=count && (i)<=(size/2)) + if (counter>=count && i<=(size/2)) { count = ownPow(2,i)/2; counter = 0;