1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
int main() {
int array[] = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4 };
int begin = 0, end = 11;
int* ret =0 ;
int a[3] = { 1, 2, 3 };
search_end(array, array + 12, a, a + 3, Odd());
Odd f;
if (*ret == array[12]) {
std::cout << "Did not find any subsequence matching { 1, 2, 3 }" << std::endl;
}
else {
std::cout << "The last matching subsequence is at: " << *ret << std::endl;
}
int b[] = { 5, 2, 3 };
search_end(array, array + end, b, b + 2);
if (*b == array[end]) {
std::cout << "Did not find any subsequence matching { 3, 2, 3 }" << std::endl;
}
else {
std::cout << "The last matching subsequence is at: " << *b << std::endl;
}
}
| |