title: Distinct number of strings in an array
body: <p><strong>UPDATED WITH FIX</strong></p>
  
  <p>I want to return only the number of unique entries in my array. The array contains a string variable that represents IP address. If there are 10 of them, but of 3 different kinds I just want to return 3. I have been at this all day and can't seem to figure out a solution that works. My code:</p>
  
  <p><strong>Original code</strong></p>
  
  <pre><code>int getUnique(Visitors info[], string url, string startDate, string endDate){
  
  int count = 0;
  
  string temp;
  
  for(int i = 0 ; i &lt; N ; i++){
  
      if(url == info[i].URL &amp;&amp; (dateChecker(startDate, endDate, info[i].dateAccessed))){
  
  
  
      }
  
  }
  
  return count;
  
  }
  </code></pre>
  
  <p><strong>Updated code</strong></p>
  
  <pre><code>int getUnique(Visitors info[], string url, string startDate, string endDate){
  
  set&lt;string&gt; ips;
  
  for(int i = 0 ; i &lt; N ; i++){
  
      if(url == info[i].URL &amp;&amp; (dateChecker(startDate, endDate, info[i].dateAccessed))){
  
         ips.insert(info[i].IP);
  
      }
  
  }
  
  return ips.size();
  
  }
  </code></pre>
  
  <p>The first if checks whether the matching URL does in fact match, and the <code>dateChecker</code> just makes sure that the date that the particular IP went to that URL is in between the 2 passed dates (<code>startDate</code> and <code>endDate</code>). How do I get the number of different IPs under these conditions?</p>