Update Binary Search.cpp

This commit is contained in:
Faizan Ahamed 2020-04-26 14:54:26 +05:30 committed by GitHub
parent dd09663ece
commit 6616ae320b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,7 @@ l = m + 1;
} }
return -1; return -1;
} }
int main() { int main(int argc, char const* argv[]) {
int n, key; int n, key;
std::cout << "Enter size of array: "; std::cout << "Enter size of array: ";
std::cin >> n; std::cin >> n;
@ -26,6 +26,6 @@ int res = binary_search(a, 0, n - 1, key);
if (res != -1) if (res != -1)
std::cout << key << " found at index " << res << std::endl; std::cout << key << " found at index " << res << std::endl;
else else
std::cout << key << " not found" << endl; std::cout << key << " not found" << endl::endl;
return 0; return 0;
} }