During the execution of the program the above error is displayed.
Aim of the code is to print "Yes" if the number 'h' is present in v vector and its corresponding index . If the number is not present you have to print "No" followed by the index of the next smallest number just greater than that number.
Thank you for help in advance.
cin >> h; //value to be searched in vector v
vector<int>::iterator lower;
lower=lower_bound(v.begin(),v.end(),h);
if(*(lower) == h){
cout<<"Yes "<<lower<<endl;
}else{
cout<<"No "<<lower<<endl;