RE: C++ Binary Search 06-19-2016, 07:13 PM
#2
This is far from "working". It actually won't even compile regardless of the console colors header file not existing.
What is 'Mid' doing in there? And aside from attempting to compare a boolean with true, you're actually assigning it true and thus the loop is syntactically synonymous with 'while(true)'
This also isn't a proper binary search because it doesn't continue with the search properly.
Code:
while (higher = true)
{
Mid
cout << green << "Mid is " << Mid;
}What is 'Mid' doing in there? And aside from attempting to compare a boolean with true, you're actually assigning it true and thus the loop is syntactically synonymous with 'while(true)'
This also isn't a proper binary search because it doesn't continue with the search properly.
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)