I am writing a magic square program that takes a 4X4 square and checks to see if it is a magic square. I have gotten everything to work exect that I don't know how to check if numbers that the user entered only appear in the 4X4 array once (i.e. Only one 1 value can be used in the square). What is the easiest way to do this? Am trying to use two for loops to accomplish this but don't know how to exactly do this... the for loops are also making sure that the numbers entered are in the range of 1 thru 16. Thanks!
for(row=0; row<4; row++)
{
for(col=0; col<4; col++)
{
int currentValue = grid[row][col];
if(currentValue<1 || currentValue > 16)
{
cout << "Eek ... a value is out of range: << currentValue
<< endl;
}
//stuff goes here to see if numbers are unique I think, but
//how??
}
}