// A demonstration of the STL find algorithm. #include #include // Needed to define the vector #include // Needed for the find algorithm using namespace std; int main() { // Define a vector object. vector numbers; // Define an iterator for the vector. vector::iterator iter; // Store some numbers in the vector. for (int x = 0; x < 10; x++) numbers.push_back(x); // Display the numbers in the vector. cout << "The numbers in the vector are:\n"; for (iter = numbers.begin(); iter != numbers.end(); iter++) cout << *iter << " "; cout << endl << endl; // Find the number 7 in the vector. iter = find(numbers.begin(), numbers.end(), 7); cout << *iter << endl; return 0; }