*Griff*, your

`while`

loop never ends. So you're basically left with an empty console to play with.That because your implementation of the binary search algorithm is wrong.

Try

C++

while( lb+1 < ub ) { int mid = (lb + ub)/2; if( a[mid] < x) { lb = mid; } else if( a[mid] == x ) { pos = mid + 1; break; } else { ub = mid; } }