title: How to get consecutive numbers in array set to 0 C++
body: <p><strong>This is what it's supposed to do:</strong>
  This function should take a 2D array and should check each row and each column for any value that is repeated/matched 3 times consecutively on a row or column. It should also recognize if there are more than 3 and should consider it all 1 match. The matched values should all be set to zero. Use the same const size. You do not know what the values could be (in the example below they are 1,2 and 3 but it could be any value other than zero).
  void checkMatches(int[ARRAY_SIZE][ARRAY_SIZE] arr)</p>
  <p>This is what I have rn:</p>
  <pre><code>const int ARRAY_SIZE=8;
  void checkMatches(int arr9[ARRAY_SIZE][ARRAY_SIZE]) {
      
      int count = 0;
  
      //check each row
      for (int row = 0; row &lt; ARRAY_SIZE; row++) {
          int i = arr9[row][0];
          for (int col = 1; col &lt; ARRAY_SIZE; col++) {
              if ( arr9[i] == arr9[i + 1]) {
                  count++;
                  if (count &gt;= 3) {
                      i = 0;
                  }
              }
              else {
                  count = 0;
              }
          }
      }
      //check each column
      for (int col = 0; col &lt; ARRAY_SIZE; col++) {
          int i = arr9[0][col];
          for (int row = 1; row &lt; ARRAY_SIZE; row++) {
              if (arr9[i] == arr9[i + 1]) {
                  count++;
                  if (count &gt; +3) {
                      i = 0;
                  }
              }
              else {
                  count = 0;
              }
          }
      }
  
  }
  
  int main(){
      int val;
      int arr9test[8][8];
  
      for (int i = 0; i &lt; 8; i++) {
          for (int j = 0; j &lt; 8; j++) {
              cout &lt;&lt; &quot;Enter number to populate the array (include a few consecutive numbers): &quot;;
              cin &gt;&gt; val;
              arr9test[j][i] = val;
          }
      }
      checkMatches(arr9test);
      cout &lt;&lt; &quot;Replacing consecutive numbers with 0's: &quot; &lt;&lt; arr9test &lt;&lt; endl;
  
  }
  </code></pre>
  <p>Any tips would be much appreciated!</p>
  <p>This is the output I'm getting. (very much not an array)
  <a href="https://i.stack.imgur.com/crN5H.png" rel="nofollow noreferrer">enter image description here</a></p>