title: extracting digits from input string c++
body: <p>I'm trying to do parsing to some input string reactions read from file at formula :2W+B=8A+10Z, I'm not interested in characters i need only to split and extract the integer values to put them in a vector  i.e vector associated with the reaction here is :[2 1 8 10]
  i thought about many things: <code>std::strtok(),isdigital(),find_first_of()</code> but they all didn't work for integer values ... can any body help ??</p>
  
  <p>here my try:</p>
  
  <pre><code>int main()
  {
    std::string input;
    std::getline(std::cin, input);
    std::stringstream stream(input);
    while(1) {
        int n;
        stream &gt;&gt; n;
        char * pch;
        pch = strtok (input," ");
        while (pch != NULL)
          {
            printf ("%s\n",pch);
            pch = strtok (NULL, " ,.");
          }
    }
  }
  </code></pre>