title: how to split a string on comma in C++
body: <p>I have this code currently in which the user would enter a number for how many numbers they want in the array. followed by '12345' however about a second after writing it i realized this would only work if they entered number 0-9 anything in double figures or more wouldnt work. </p>
  
  <pre><code>int numberOfValues;
  cout &lt;&lt; "Please enter the amount of integers you want in the array" &lt;&lt; endl;
  cin &gt;&gt; numberOfValues;
  
  int valuesArray[numberOfValues];
  string valuesString;
  
  cout &lt;&lt; "Please Enter " &lt;&lt; numberOfValues &lt;&lt; " numbers" &lt;&lt; endl;
  cin&gt;&gt;valuesString;
  
  
  for(int i = 0; i &lt; numberOfValues; i++)
  {
      valuesArray[i] = valuesString[i];
  }
  return valuesArray;
  </code></pre>
  
  <p>im thinking that the best way to do this would be for the user to enter numbers separated by a comma and to split them afterwards (iv done this same little porgram in java and trying to change it to C++ for my own personal learning) like in java i used string.split(",") i was wondering if there is anything similar in c++??</p>