A
arunix
hello dear all its mine first post here i am newbie with "C++" i am
learning "C++ Algorithms" here is mine problem that i am ussing
"binary_search" into the code its given me "false value" 0 boz when i
gave the number which is in the list it gives me the False Part "Your
Number is not in the List" when condition is true. plz tell me whats
wrong with mine code
here is mine code.
#include<iostream>
#include<algorithm>
int main()
{
int num[]={2,6,25,14,86,52,64,75,27,52,96,58,52.0};
const int start=1, end=2;
int check;
std :: cout <<"please Enter Your Number :- ";
std :: cin >> check;
if(std ::binary_search((num+start),(num+end),check))
{
std :: cout<<" Your Value is in the List " << check <<std ::
endl;
}
else
{
std :: cout <<"Your Number is not in the List "
<<std :: endl;
}
return 0;
}
learning "C++ Algorithms" here is mine problem that i am ussing
"binary_search" into the code its given me "false value" 0 boz when i
gave the number which is in the list it gives me the False Part "Your
Number is not in the List" when condition is true. plz tell me whats
wrong with mine code
here is mine code.
#include<iostream>
#include<algorithm>
int main()
{
int num[]={2,6,25,14,86,52,64,75,27,52,96,58,52.0};
const int start=1, end=2;
int check;
std :: cout <<"please Enter Your Number :- ";
std :: cin >> check;
if(std ::binary_search((num+start),(num+end),check))
{
std :: cout<<" Your Value is in the List " << check <<std ::
endl;
}
else
{
std :: cout <<"Your Number is not in the List "
<<std :: endl;
}
return 0;
}