last
This commit is contained in:
parent
e9d91350a4
commit
711c7beb56
35
a4/program.c
35
a4/program.c
@ -39,6 +39,7 @@ int main(){
|
||||
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
vypisovac(vypis,inputNum,i+1);
|
||||
return 0;
|
||||
}
|
||||
@ -62,9 +63,41 @@ bool jeKopa(int i, int inputNum[SIZE]){
|
||||
return 1;
|
||||
}
|
||||
void vypisovac(int vypis[SIZE], int input[SIZE], int size){
|
||||
int counter = 0, count = ownPow(2,0), space = 0, i = 0;
|
||||
int counter = 0, count = ownPow(2,0), space = 0, i = 1, lastRow, indexLast = 0, next = 0;
|
||||
while (ownPow(2,i)<= size){
|
||||
i++;
|
||||
}
|
||||
lastRow = (-1)*((ownPow(2,i-1)-1) - size);
|
||||
indexLast = i-1;
|
||||
if (lastRow == 0)
|
||||
{
|
||||
lastRow = (ownPow(2,i-1)-1);
|
||||
indexLast = i-2;
|
||||
}
|
||||
i = 0;
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
while (space == indexLast)
|
||||
{
|
||||
counter++;
|
||||
for (int k = 0; k < space; k++)
|
||||
{
|
||||
printf(" ");
|
||||
}
|
||||
printf("%d\n",input[vypis[(int)i]]);
|
||||
if (counter>=count)
|
||||
{
|
||||
next = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
if (next)
|
||||
{
|
||||
next = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (counter>=count && i<=(size/2))
|
||||
{
|
||||
count = ownPow(2,i)/2;
|
||||
|
Loading…
Reference in New Issue
Block a user