title: C/C++ How can I get unique value from 2 arrays?
body: <p>I need to get the unique value from 2 int arrays</p>
  
  <p>Duplicate is allowed</p>
  
  <p>There is just one unique value</p>
  
  <p>like :</p>
  
  <pre><code>int arr1[3]={1,2,3};
  int arr2[3]={2,2,3};
  </code></pre>
  
  <p>and the value i want to get is :</p>
  
  <pre><code>int unique[]={1}
  </code></pre>
  
  <p>how can i do this?
  im already confused in my 'for' and 'if'
  this was not homework </p>
  
  <p>i know how to merge 2 arrays and del duplicate values</p>
  
  <p>but i alse need to know which array have the unique value</p>
  
  <p>plz help me :)</p>
  
  <p>and here is some code i did</p>
  
  <pre><code>int arr1[3]={1,2,3}
  int arr2[3]={2,2,3}
  int arrunique[1];
  bool unique = true;
  for (int i=0;i!=3;i++)
  {
  
      for (int j=0;j!=3;j++)
      {
      if(arr1[i]==arr2[j])
      {
          unique=false;
          continue;
      }
      else 
      {
          unique=true;
      }
  if(unique)
  {
  arrunique[0]=arr1[i]
  break;
  }
  }
  
  cout &lt;&lt; arrunique[0];
  </code></pre>