There is a problem with the way it runs. What it does now it either says 16 rather than valid or gives me some sort of summation. Basically the way I want it to work is if there is repetition it needs to set the boolean value to false, or if there is out of range going on then it sets it to false. Or if both happen set to false.
Within set {{1,1,1,1}, {2,2,2,2}, {17,18,18, 5}, {-1, 6, 7, 8}}
the code you gave me outputs
{1,1,1,2,2,2, 18}
when it should output
{1,1,1,2,2,2,17,18,18,-1}
bool validateRange(int theSquare [][4], const int numRows, const int magicvalue)
{ bool good = true;int i, j, num[16]={0};
cout << "RANG: ";
for (i = 0; i<4; i++)
for (j=0;j<4;j++)
{num[theSquare [i][j]]+=1;
if (theSquare[i][j]<1 || theSquare[i][j] >16)
{good = false;
cout << theSquare[i][j];
if(num[theSquare[i][j]] > 1)
{cout <<num[theSquare[i][j]];
good = false;}
}
}
if (good == true)
{cout <<"VALID" << endl;
}
else
{
cout << endl;
}
return good;
}