#include <iostream>
#include <string>
#include <vector>
typedef std::vector<int>::const_iterator VectIter;
bool find (VectIter begin, VectIter end, int value)
{
while (begin != end)
{
if (*begin == value)
return true;
begin++;
}
return false;
}
int main()
{
std::vector<int> v = {1, 2, 3, 4, 5, 6, 7};
std::vector<int>::const_iterator it = v.begin();
std::cout << find (v.begin(), v.end(), 4) << std::endl;
std::cout << find (v.begin(), v.begin(), 1) << std::endl;
std::cout << find (v.begin(), v.end(), 13) << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8dmVjdG9yPgoKdHlwZWRlZiBzdGQ6OnZlY3RvcjxpbnQ+Ojpjb25zdF9pdGVyYXRvciBWZWN0SXRlcjsKCmJvb2wgZmluZCAoVmVjdEl0ZXIgYmVnaW4sIFZlY3RJdGVyIGVuZCwgaW50IHZhbHVlKQp7CiAgICAgICAgd2hpbGUgKGJlZ2luICE9IGVuZCkKICAgICAgICB7CiAgICAgICAgICAgICAgICBpZiAoKmJlZ2luID09IHZhbHVlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgICAgIGJlZ2luKys7CiAgICAgICAgfQogICAgICAgIHJldHVybiBmYWxzZTsKfQoKaW50IG1haW4oKQp7CiAgICAgICAgc3RkOjp2ZWN0b3I8aW50PiB2ID0gezEsIDIsIDMsIDQsIDUsIDYsIDd9OwogICAgICAgIHN0ZDo6dmVjdG9yPGludD46OmNvbnN0X2l0ZXJhdG9yIGl0ID0gdi5iZWdpbigpOwoKICAgICAgICBzdGQ6OmNvdXQgPDwgZmluZCAodi5iZWdpbigpLCB2LmVuZCgpLCA0KSA8PCBzdGQ6OmVuZGw7CiAgICAgICAgc3RkOjpjb3V0IDw8IGZpbmQgKHYuYmVnaW4oKSwgdi5iZWdpbigpLCAxKSA8PCBzdGQ6OmVuZGw7CiAgICAgICAgc3RkOjpjb3V0IDw8IGZpbmQgKHYuYmVnaW4oKSwgdi5lbmQoKSwgMTMpIDw8IHN0ZDo6ZW5kbDsKfQo=