title: C++ - Count integers from .txt file
body: <p>I want to count integers from <em>.txt</em> file named "Example.<strong>in</strong>", which contains (for example):</p>
  
  <pre><code>1  2  3  4  5
  3 6 7
  5 8
  8 9 10 11
  </code></pre>
  
  <p><strong>1.</strong> and returns me a 11, in this case (Integers that repeat counts as 1 - unique number count only). At this point, it only prints out 0 (I think there's problem with opening file at this stage).</p>
  
  <p><strong>2.</strong> prints out only the first integers in every row - 1, 3, 5, 8.</p>
  
  <pre><code> int integer_count(){
   int count = 0;
   int i;
   ifstream fin;
   fin.open("Example.in"); //.txt file
  
   while(fin &gt;&gt; i)
   {
       count++;
   }
  fin.close();
  return count; // In this case it should print 14 instead of 11, 
      because I didn't count out 3, 5 and 8 (which duplicates - haven't figured         
      out  how to make unique count that would close eye for duplicates and 
      just count unique integers.)
  }
  </code></pre>