954,545 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Data validation within a multi-dimensional array

I need to validate the numbers 1-16 within the given array. Any numbers that are duplicate or are outside of the range need to be outputted. While if all numbers 1-16 are inputted only once then the boolean value is true.
The numbers for the array theSquare are inputted previous to this function. So assume some generic array of numbers have been inputted.

NEED HELP QUICK:

bool validateRange(int theSquare [][4], const int numRows, const int magicvalue)
{ bool good = true;int i, j;
cout << "RANG: ";
for (i = 0; i<4; i++)
for (j=0;j<4;j++)
{
if (theSquare[i][j]<1 || theSquare[i][j] >16)
{good = false;
cout << theSquare[i][j] <1 || theSquare[i][j] > 16; }}

if (good == true)
{cout <<"VALID" << endl;
}
else
{
cout << endl;
}
return good;
}

lanario
Newbie Poster
10 posts since Mar 2006
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You