c++ counting how many words in line
<p>I'm using this code to count lines of the text, but I need to count also words and show to console how many words is in each row.</p>

<pre><code>int main(int argc, char *argv[]){

    ifstream f1("text.txt"); ;
    char c;
    string b;
    int numchars[10] = {}, numlines = 0;

    f1.get(c);
    while (f1) {
        while (f1 &amp;&amp; c != '\n') {

           // here I want to count how many words is in row
        }

        cout&lt;&lt;"in row: "&lt;&lt; numlines + 1 &lt;&lt;"words: "&lt;&lt; numchars[numlines] &lt;&lt; endl;
        numlines = numlines + 1;
        f1.get(c);
   }

   f1.close();
   system("PAUSE");
   return EXIT_SUCCESS;
}
</code></pre>