title: Breaking up a string with a delimiter C++
body: <p>I've been trying to break up a string that has a delimiter, in this case it is a comma.</p>
  <pre><code>int main()
  {
  string test = &quot;12345,768,11,987,567812&quot;;
  int temp = 0;
  for (int i = 0; i &lt; test.size(); i++) {
      if (test[i] == ',') {
          cout &lt;&lt; test.substr(temp, i) &lt;&lt; endl;
          temp = i+1;
      }
  }
  
  return 0;
  }
  </code></pre>
  <p>This is the code I have so far. The first string gets broken up correctly but after that it doesn't work and I'm not sure why.</p>