title: C++: separating first and last name from a file, separated by a comma
body: <p>I have this as a file:</p>
  
  <pre><code>Collins,Bill 80
  Smith,Bart 75
  Allen,Jim 82
  Griffin,Jim 55
  Stamey,Marty 90
  Rose,Geri 78
  Taylor,Terri 56
  Johnson,Jill 77
  Allison,Jeff 45
  Looney,Joe 89
  Wolfe,Bill 63
  James,Jean 72
  Weaver,Jim 77
  Pore,Bob 91 
  Rutherford,Greg 42
  Javens,Renee 74
  Harrison,Rose 58
  Setzer,Cathy 93
  Pike,Gordon 48
  Holland,Beth 79
  </code></pre>
  
  <p>As you can see the last name and first name are separated with a comma.</p>
  
  <p>Right now I have this in my code:</p>
  
  <pre><code>ifstream inputFile;
  inputFile.open ("students.txt");
  
  string studentNames;            // Student names - Last name followed by first
  int studentMarks = 0;           // Student mark for text/exam
  
  // Read in data from students.txt
  inputFile &gt;&gt; studentNames;
  inputFile &gt;&gt; studentMarks;
  
  // IF file has too much data, output WARNING
  if (numElts &gt;= NUM_NAMES)
  {
      cout &lt;&lt; "Error: File contains too many lines of data, check the file." &lt;&lt; endl &lt;&lt; endl;
  }
  else
  {
      names[numElts] = studentNames;
      marks[numElts] = studentMarks;
      numElts++;
  }
  </code></pre>
  
  <p>I want to bypass these commas, I want to store it as firstname and then last name which then I will just merge into name like <code>name = firstname " " last name</code>.   How should I do that, please?</p>