Good way to tokenize a string to store values? Or alternative for user input
<p>Hello again Stackoverflow, I'm here again asking a question for my C++ programming class. The problem I am facing is mostly to due with user input from the keyboard. I need to be able to take the user input to decide what function to call and what arguments to give the function. For example something like <code>add 5</code> would call the add function with the argument 5. At first I tried overloading the >> operator to take both a string and an int but the problem I ran into was the program was unable to take input without the int such as <code>deletemax</code> so I had to throw that idea out. So now I am back to tokenizing the input but we are not allowed to use Boost for this program so I came up with something like this using sstream</p>

<pre><code>    bool out = false;
string token;
string In;
int num;

do
{
    cout &lt;&lt; "heap&gt; ";
    cin &gt;&gt; In;
    istringstream iss(In);
    while(getline(iss, token, ' '))
    {
      cout &lt;&lt; token &lt;&lt; endl; //I know this is incorrect but just not what to replace it with
    }
    out = ProcessCommand (token, num); //Takes string and int to call correct functions
} while (out != true);
</code></pre>

<p>The problem lies in that I'm not quite sure how to correctly tokenize the string so I can get 2 string and convert the second string to an int. Can anyone offer me some assistance? I would greatly appreciate it. Also if there is a better way to go about this than I am trying I would also like to hear it.</p>

<p>Thanks for any help you can give me.</p>
