title: Unique integer in array
body: <p>I have made a programm that determines if your integers make a magic square. There is a 2D array, which i would like to fill with numbers, but as you may know the square consists of values from 1 to (N*N) at the moment the loop checks if the integer is greater than 0 and if its not out of boundries. 
  What I wanted to do is to check if input integer is unique, that is, if it is not used in array before. I tried to do something with another array which is filled with ones, and a <em>do loop</em> , but i had some problems, to execute loop as long as i get error message, that made me belive that it was just a crappy idea to try that, or it was poorly executed. Maybe anyone of you has an idea of how to execute this loop and restart it. I'd like to know it it was the right way with another array and a <em>do loop</em>
  Here is the original loop: </p>
  
  <pre><code>for (int i=0; i&lt;N; i++)
  for (int j=0; j&lt;N; j++)
  {
      cin &gt;&gt; arr[i][j];              ///Cikls ar kura palidzibu tiek aizpildits magiskais kvadrats
      if(arr[i][j] &lt;= 0 || arr[i][j]&gt;(N*N))
          {
              i=0;
              j=0;
              cout &lt;&lt; error&lt;&lt; endl;
              cin &gt;&gt; arr[i][j];
  
          }
  }
  </code></pre>
  
  <p>As for the full code it is a long and structured in a weird manner and the comments are not in english aswell, but im willing to edit it in by request if it will do any good. 
  I'm using no libraries.</p>