| | |
Data validation within a multi-dimensional array
Thread Solved |
•
•
Join Date: Mar 2006
Posts: 10
Reputation:
Solved Threads: 0
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;
}
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;
}
![]() |
Similar Threads
- Passing multi-dimensional array (C)
- assign elements to a multi-d array (C)
- Multi-dimensional Arrays: (Python)
- Validation with js of two dimensional array (JavaScript / DHTML / AJAX)
- multi dimensional array search xml parser (PHP)
- Need help passing a multi-dimensional array (C++)
Other Threads in the Java Forum
- Previous Thread: Help for a Biologist
- Next Thread: Class File, making directories... relative to
| Thread Tools | Search this Thread |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card chat class classes client code collision columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress input integer intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop machine map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle parsing plazmic print problem program programming project recursion scanner server set sharepoint smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads tree trolltech unlimited utility webservices windows





