-1
I am trying to solve an exercise involving the comparison of values of a matrix, ie if there are repeated elements, for example: the matrix 2x2 has the element A that repeats N times. Could someone tell me how I could make that comparison? Thanks in advance!
void verificaRepeticao()
{
int i,j,p,q;
int cont=0;
for (i = 0;i < n;i++)//n e m é a quantidade de linhas e colunas informada pelo usuário em outra função
{
for (j = 0;j < m;j++)
{
for (p=0;p<n;p++)
{
for (q=0;q<m;q++)
{
if (matriz[p][q] == matriz[i][j])
{
vetor[cont] += 1;
}
}
}
}
cont++;
}
}