Separing a string in separate words
<p>Take this string:</p>

<pre><code>asking  a question    is easy
</code></pre>

<p>I want in a while loop</p>

<ul>
<li>take first word <code>asking</code>,</li>
<li>check something about it with a function,</li>
<li>then get to the next word <code>a</code></li>
<li>and so on until the end of the string</li>
</ul>

<p>Words can be separated by one or more spaces.</p>

<p><strong>Edit:</strong></p>

<p>I think I actually made a mistake when explaining. Here what I've been working on:</p>

<pre><code>int main()
{
    cout&lt;&lt;"string="; gets(string);
    cout&lt;&lt;"template="; cin&gt;&gt;template;
    while (i&lt;strlen(string))
    {
        k=0;
        while (string[i]!=' ')
        {
            word[k]=string[i];
            i++; k++;
        }
        if (function(string,word)==1) count++;
        while (i&lt;strlen(s) &amp;&amp; string[i]==' ')
          i++;
    }
    cout &lt;&lt;"count="&lt;&lt;count;
}
</code></pre>

<p>I'd like to stick to some old/basic C++ like I do in school.</p>
