title: C++ Update console output
body: <p>I'm trying to make a program to print out a grid and given x and y co-ordinates change a value in the grid. For example, if the user entered X:0 and Y:0 it would change the value '9' in the image below to a predefined value (in this case I want to change the value 9 to 0).</p>
  
  <p><a href="https://i.stack.imgur.com/UBvC9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UBvC9.png" alt="enter image description here"></a></p>
  
  <p>My question is, is it possible to update the output of the console so that the '0' would override the '9' without printing out the entire grid again. I want to be able to do this multiple times.</p>
  
  <p>If that is not possible, how can I print out the updated grid the way I have implemented this? If I were to put the display grid <em>for loop</em> in a separate function I would need to call the 2d array as a parameter which I'm sure you cannot do.</p>
  
  <p>Here is what I have:</p>
  
  <pre><code>void generateGrid(int diff){
          srand(time(NULL));
          int arr[maximum][maximum];
              for (int i=0;i&lt;diff;i++)
          {
              for (int j=0;j&lt;diff;j++)
              {
                  arr[i][j] = rand() % 9 + 1;
              }
          }
          cout&lt;&lt;"\n\tPuzzle\n\t";
              for(int i=0;i&lt;diff;i++)
              {
                  cout&lt;&lt;i&lt;&lt;" ";
              }
                  cout&lt;&lt;"\n\n";
              for(int i=0;i&lt;diff;i++)
              {
                  cout&lt;&lt;i&lt;&lt;"\t";
                  for(int j=0;j&lt;diff;j++)
                  {
                      cout&lt;&lt;arr[i][j]&lt;&lt;" ";
                  }
                      cout&lt;&lt;"\n";
              }
         int x, y;
          cout&lt;&lt;"\nEnter x value: ";
          cin&gt;&gt;x;
          cout&lt;&lt;"Enter y value: ";
          cin&gt;&gt;y;
          arr[x][y] = 0;
      }
  </code></pre>
  
  <p>Diff refers to the puzzle size (difficulty) </p>
  
  <p>Elsewhere:</p>
  
  <pre><code>int easy = 5;
  int medium = 8;
  int hard = 10;
  int maximum = 10;
  </code></pre>