could anyone suggest me a simple way of splitting names in C++
<p>I've been trying to split a name into first and last name, but I'm sure my implementation is not the best one as far as simplicity.</p>

<pre><code>string name = "John Smith";
    string first;
    string last (name, name.find(" "));//getting lastname
    for(int i=0; i&lt;name.find(" "); i++)
    {
        first += name[i];//getting firstname
    }
    cout &lt;&lt; "First: "&lt;&lt; first &lt;&lt; " Last: " &lt;&lt; last &lt;&lt; endl;
</code></pre>

<p>Thanks in advance</p>
