title: How do I calculate and output punctuation marks using ispunct() for an input file
body: <p>I have a text file with a huge paragraph and I wanna be able to count and output all the punctuation marks in my file.. here is my code so far, it just prints "0"
  Thanks. </p>
  
  <pre><code>int main(){
  inFile.open("Horoscope.txt");
  if (!inFile)
  {
      cerr &lt;&lt; "Error: Input file opening failed\n";
      return EXIT_FAILURE;
  }
  
  int punct = 0;
  char input = ' ';
  while (inFile &gt;&gt; input)
  {
      if (ispunct(input))
      {
          punct++;
      }
      inFile.close();
      cout &lt;&lt; "There are " &lt;&lt; punct &lt;&lt; " punctuation marks in the text file" 
  &lt;&lt; endl; 
  }
  }
  </code></pre>