lanario 0 Newbie Poster

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.


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;
     cout << endl;
    return good;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.