#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<char> vectorObject;
vector<char>::iterator p;
int i;
for(i = 0; i <10; i++)
vectorObject.push_back('A' + i);
cout << "Contents of vectorObject: ";
for(i = 0; i <vectorObject.size(); i++)
cout << vectorObject[ i ];
cout << endl;
cout << "Looking for F...";
p = lower_bound(vectorObject.begin(), vectorObject.end(), 'F');
if(p != vectorObject.end())
cout << *p << " Found";
else
cout << "F Not Found";
cout << "\n Looking for X.";
p = lower_bound(vectorObject.begin(), vectorObject.end(), 'X');
if(p != vectorObject.end())
cout << *p << " Found";
else
cout << "X Not Found";
return 0;
}
|