![]() |
|
C++ Binary Search - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: C, C++, & Obj-C (https://sinister.ly/Forum-C-C-Obj-C) +--- Thread: C++ Binary Search (/Thread-C-Binary-Search) |
C++ Binary Search - Mafia - 05-05-2016 A binary search is a method of searching for some data in a specific way, you can see it in action here: ![]() I done this for my cousin's computer science work when he got stuck a while back, so it's not that good, but it works! https://mega.nz/#!VMUlQYwa!YInljZQC-nHnSKSVVyW9eMmqBmE53RxkxAszb3ILlL0 Please note, the color on the text is an external library I can't seem to find, if requested I will find it. RE: C++ Binary Search - 0xDEAD10CC - 06-19-2016 This is far from "working". It actually won't even compile regardless of the console colors header file not existing. 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. |