S
SabaUd
Hello,
I wrote a short program that needs to calculate capacity of stack.
i have 2 ints and im trying to do so.
my code:
Stack* selectedStack = ...;
double fActual = (double)selectedStack->nActualSize;
double fAllocated = (double)selectedStack->nAllocatedSize;
double fCapacity = (fActual / fAllocated) * 100.0;
printf("%d ", (int)ceil(fCapacity));
Now - this one works, but it's disgusting code...
I'm sure there's a more elegant way to execute it...
any ideas?
I wrote a short program that needs to calculate capacity of stack.
i have 2 ints and im trying to do so.
my code:
Stack* selectedStack = ...;
double fActual = (double)selectedStack->nActualSize;
double fAllocated = (double)selectedStack->nAllocatedSize;
double fCapacity = (fActual / fAllocated) * 100.0;
printf("%d ", (int)ceil(fCapacity));
Now - this one works, but it's disgusting code...
I'm sure there's a more elegant way to execute it...
any ideas?