Data validation within a multi-dimensional array

Thread Solved

Join Date: Mar 2006
Posts: 10
Reputation: lanario is an unknown quantity at this point 
Solved Threads: 0
lanario lanario is offline Offline
Newbie Poster

Data validation within a multi-dimensional array

 
0
  #1
Apr 7th, 2006
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;
}
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC