PROGRAM :
Code:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool myfunction (int p, int q)
{
return (p==q);
}
int main ()
{
int mint[] = {1,2,3,4,5,1,2,3,4,5};
vector<int> mvctr (mint,mint+10);
vector<int>::iterator t;
int mtch1[] = {1,2,3};
t = find_end (mvctr.begin(), mvctr.end(), mtch1, mtch1+3);
if (t!=mvctr.end())
cout << "match1 last found at position " << int(t-mvctr.begin()) << endl;
int mtch2[] = {4,5,1};
t = find_end (mvctr.begin(), mvctr.end(), mtch2, mtch2+3, mfnctn);
if (t!=mvctr.end())
cout << "match2 last found at position " << int(t-mvctr.begin()) << endl;
return 0;
}
Output :
Code:
Match found at position 5
Match found at position 3
Bookmarks