I have an 5x10 array that is populated with random values 1-5. I want to be able to check when 3 numbers, either horizontally, or vertically, match. I can\'t figure out a wa
I think this should work ; If any one point out the mistake, I would be happy to correct.
for( int row = 0; row<8 ; ++row )
{
bool outerLoopBreakFlag = false ;
for( int col=0 ; col<3; ++col )
{
// check for the winning conditions
// i.e., board[row][col] == board[row][col+1] == board[row][col+2]
// board[row][col] == board[row+1][col] == board[row+2][col]
// if any one is satisfied, set the outerLoopBreakFlag to true
else
break ;
}
if( outerLoopBreakFlag == true )
break ;
}