#include <iostream>
using namespace std;
int main()
{
int data[] = {32, 30, 12, 60, 50, 5, 90, 9};
int data_size = sizeof(data)/sizeof(int);
// ENTER SUB-SEQUENCE
int limit{0};
cout << "Enter how many numbers to check in sequence? ";
cin >> limit;
int* sub_array = new int[limit];
cout <<"What elements do you want to find in the array? ";
for(int i = 0; i < limit; i++)
{
cin >> sub_array[i];
}
// FIND FIRST ELEMENT
int index{0};
while (index < data_size && data[index] != sub_array[0] )
{
index++;
}
// CHECK REMAINDER OF SUB-SEQUENCE
if(index < data_size)
{
cout << "Matching elements found as follows: " << data[index] << ' ';
for(int i = 1; i < limit; i++)
{
for(int j = index; j < data_size; j++)
{
if(sub_array[i] == data[j])
{
cout << data[j] << ' ';
}
}
}
}
cout << '\n';
delete[] sub_array;
return 0;
}