Checking elements and positions. Vectors

The exercise is this:
Assign two vectors of integers with the same length. Verify that for each couple V1i and V2j (with V1i belonging to the first vector and V2j to the second one) exist one of the following conditions:
- A sequence of the last numbers (at least two) of V1i coincide with a sequence of the initial numbers of V2j like in the following couples (2321, 21456), (6357, 6357), (12908, 2908);
- A sequence of the last numbers (at least two) of V2i coincide with a sequence of the initial numbers of V1j.
For each couple that meet one of the two conditions report the sequence of number in common, the type of condition and the position of i and j within the
vectors V1 and V2;

I tried writing the code but whatever I write it is completely wrong so I'll just write the initialization for now

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>

using namespace std;

int main () {
	//Initialization:
	const int N = 5;									//Initializing constant for the vectors.
	int V1[N] = {2, 3, 2, 1};							//Initializing the vector.
	int V2[N] = {2, 1, 4, 5, 6};						//Initializing the vector.
	int V3[N];											//Initializing the vector in which save the common sequence.
	bool check = false;									//Initializing the condition.
	int posi = 0;										//Initializing where to save the position i.
	int posj = 0;										//Initializing where to save the position j. 


I don't know how to check the last numbers of the first vector and, at the same time, the first numbers of the second vector.
Is it a mixture of for loops and while loops? I really don't know what should I write to check.
Erm, I don't see a single vector in your code. I see some C-style arrays.
That's how the professor wants it to be coded.
Topic archived. No new replies allowed.