actually, I still have 1 small error.
i'm getting 0, 4, 6, 6 instead of 0, 3, 6, 6
i tested this out with other numbers. it's not giving the difference for the 2nd number in the result.
for example if i put:
10, 4, -2, 3
i get
0, 10, 12, 12 instead of 0, 6, 12, 12
if i put
1, 14, -2, -3
i get
0, 14, 16, 17 instead of 0, 13, -2, -3
etc.
seems as though something is wrong with the first number entered. maybe there's something wrong with:
1 2 3 4 5 6 7 8 9
|
if( !beenHere )
{
beenHere = true;
if( x > 0 ){
largestNow = x;
}
else
smallestNow = x;
}
|
i tried, but i don't know what's wrong here. any ideas?