once again probably trivial, and i can't seem to find this stuff anywhere.
i've created a binary search
it is part of a class function.my question is how do i get the values low and high, to pas to the function from main(). i know that the high and low should be the contents of the min slot number and the max slot number but i just can't seem to pass them right...Code:int Narray::find(int low, int high, int num) { while (low == high) { int mid = (low + high) 2; if (num >= marray.a[mid]) { low = mid + 1; } else if (num <= marray.a[mid]) { high = mid - 1; } else { cout << The number was found in slot << marray.a[mid]; } } return -1; }
thanks for any help