0

Hello,

I have 2 vectors, and I'm trying to search/scan the first vector for the second vector.

Let's say I have this vector/Matrix:

M1 =

```
0 1 1 0
0 1 1 1
1 0 1 1
0 0 0 1
```

M2 =

```
0 1
0 1
```

Then I will search the M1 for M2 by scanning each value (Kind of like a binary tree) or until it's found the right solution. Now I'm using an algorithm like this:

```
const int ROW_BOUNDS = matrix1.size() - matrix2.size(); // 16 - 4
const int COL_BOUNDS = 4 - 2;
bool found = false;
for(int i=0; (i < ROW_BOUNDS); i++)
{
bool matchFound = false;
for(int j=0; (j < COL_BOUNDS); j++) {
cout << matrix1[i*4+j] << ' ';
}
cout << endl;
}
```

But when I try to output the results (using the same data provided above) I get this:

```
0 1
0 1
1 0
0 0
0 1
2.1536e-314 2.1536e-314
0 0
0 0
0 1
9.88131e-324 2.78134e-309
0 0
0 0
```

But I have tried different calculations, different values and I get the same result. I'm wondering if anyone can see where I'm going wrong and offer some help?

Thanks :)