Standard C++ Library User Guide and Tutorial
 // illustrate the use of the binary search algorithm
{
 // make an ordered vector of 15 random integers
 vector<int> aVec(15);
 generate (aVec.begin(), aVec.end(), randomValue);
 sort (aVec.begin(), aVec.end());
 // see if it contains an eleven
 if (binary_search (aVec.begin(), aVec.end(), 11))
 cout << "contains an 11" << endl;
 else
 cout << "does not contain an 11" << endl;
 // insert an 11 and a 14
 vector<int>::iterator where;
 where = lower_bound (aVec.begin(), aVec.end(), 11);
 aVec.insert (where, 11);
 where = upper_bound (aVec.begin(), aVec.end(), 14);
 aVec.insert (where, 14);
}










