//STL示例 指针迭代器
#include <iostream.h>
#include <algorithm>
using namespace std;
#define SIZE 100
int iarray[SIZE];
int main()
{
iarray[20] = 50;
int* ip = find(iarray, iarray + SIZE, 50);//algorithm头文件中定义的一个方法,返回一个指针迭代器InputIterator
if (ip == iarray + SIZE)//如果指针指到数组的末尾,那么就没有找到
cout << "50 not found in array" << endl;
else
cout << *ip << " found in array" << endl;
return 0;
}