```
#include <stdio.h>
#include <omp.h>
#include <iostream>
int main ()
{
int n = 3;
int m = 4;// neurons
int ** mas = new int* [n];//samples for training
for (int count = 0; count <m; count ++)
mas [count] = new int [m];
int *y = new int [m];
mas [0 [0] =-1; mas [0 [1] = 1; mas [0 [2] =-1; mas [0 [3] = 1;
mas [1 [0] = 1; mas [1 [1] =-1; mas [1 [2] = 1; mas [1 [3] = 1;
mas [2 [0] =-1; mas [2 [1] = 1; mas [2 [2] =-1; mas [2 [3] =-1;
int i = 0, j = 0;
std:: string s = "";
int ** w = new int* [m];//
for (int count = 0; count <m; count ++)
w [count] = new int [m];
int ** tm = new int * [m];//the Temporary array
for (int count = 0; count <m; count ++)
tm [count] = new int [m];
int k = 0;
//I find W
for (k = 0; k <n; k ++)
{
for (i = 0; i <m; i ++)
for (j = 0; j <m; j ++)
tm [i] [j] = mas [k] [i] * mas [k] [j];
//I find the total tm [i]
for (i = 0; i <m; i ++)
for (j = 0; j <m; j ++)
w [i] [j] + = tm [i] [j];
}
//I Nullify a principal diagonal w
for (i = 0; i <m; i ++)
w [i] [i] = 0;
int *a = new int [m];//f-ija activations
bool b = false; k = 0;//the Counter
int l =-1;//the Index of a suitable line
while (! b && k <200)
{
//I Calculate y'
for (i = 0; i <m; i ++)
for (j = 0; j <m; j ++)
a [i] + = w [i] [j] * y [j];
//I Process y ' f activation
for (i = 0; i <m; i ++)
if (a [i]> = 0) a [i] = 1;
else a [i] =-1;
//I Compare
bool st = false;
for (i = 0; i <n; i ++)
{
st = true;
for (j = 0; j <m; j ++)
if (mas [i] [j]! = a [j]) {st = false; break;}
if (st) {l = i; break;}
}
if (l! =-1) b = true;
else
{
k ++;//I Increase the counter
//It is updated at'
for (i = 0; i <m; i ++)
y [i] = a [i];
//It is nullable a
for (i = 0; i <m; i ++)
a [i] = 0;
}
}
if (l! =-1)
{
printf ("clones with X = %i", (l + 1));
}
else
{
printf ("no clones");
}
system ("PAUSE");
}
```

]]>