Fix result printing

master
En Yi 2019-08-26 18:51:31 +08:00
parent b652cffba4
commit 3794906b0b
2 changed files with 2 additions and 2 deletions

View File

@ -69,7 +69,7 @@ int main(int argc, char** argv){
std::cout << "Finding " << val << "..."<<std::endl;
int pos = splitted_array_search(split_array, 0, n-1, val, n);
if (val >=0)
if (pos >=0)
std::cout << val << " is at index " << pos << std::endl;
else
std::cout << "Value not found" << std::endl;

View File

@ -72,7 +72,7 @@ int main(int argc, char** argv){
usleep(1000000);
int pos = splitted_array_search(split_array, 0, n-1, val, n);
std::cout << std::endl;
if (val >=0)
if (pos >=0)
std::cout << val << " is at index " << pos << std::endl;
else
std::cout << "Value not found" << std::endl;