title: How to compare each element of one array to another if present then print Yes otherwise no
body: <pre><code>#include&lt;iostream&gt; 
  using namespace std;
  int main()
  {
      int a[8] = { 1, 2, 3, 6, 4, 8, 12, 5 }; 
      int b[6] = { 1, 3, 12, 5, 9, 10 };    
      for (int i = 0; i &lt; 8; i++)
      {
          for(int j=0;j&lt;6;j++)
          {
              if(b[j]==a[i])
              {
                  cout&lt;&lt;"Yes"&lt;&lt;endl;
              }
          }
          cout&lt;&lt;"NO"&lt;&lt;endl;
      }
  }
  </code></pre>
  
  <p>i have to compare these array and of element of second array is present in first array then print yes else no 
  .
  I am getting output as </p>
  
  <pre><code>Yes
  NO
  NO
  Yes
  NO
  NO
  NO
  NO
  Yes
  NO
  Yes
  NO
  </code></pre>
  
  <p>I have to get output like this </p>
  
  <pre><code>yes
  yes
  yes
  yes
  No
  No
  </code></pre>