title: Breaking a single string into multiple strings C++?
body: <p>I need to input 3 full names separated by commas</p>
  
  <p>Full Name 1: John, Smith, Flynn<br>
  Full Name 2: Walter, Kennedy, Roberts<br>
  Full Name 3: Sam, Bass, Clinton<br></p>
  
  <p>Then output it like this</p>
  
  <p>First Name 1: John<br>
  First Name 2: Walter<br>
  First Name 3: Sam<br></p>
  
  <p>Middle Name 1: Smith<br>
  Middle Name 2: Kennedy<br>
  Middle Name 3: Bass<br></p>
  
  <p>Last Name 1: Flynn<br>
  Last Name 2: Roberts<br>
  Last Name 3: Clinton<br></p>
  
  <p>How do i do these?
  so far this is my code</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;cstdio&gt;
  #include&lt;cstring&gt;
  using namespace std;
  
  int main () {
      char first[3][100];
      char middle[3][100];
      char last[3][100];
      char full[3][100];
      int i; 
  
      cout &lt;&lt; "Enter 3 Full Names &lt;first, middle and last names separated by comma&gt;:" &lt;&lt; endl;
      for (i=0; i&lt;3; i++) {
           cout &lt;&lt; "Full Name " &lt;&lt; i+1 &lt;&lt; ":" ;
          gets (full[i]);          
      }
  
      cout &lt;&lt; "The first names are: " &lt;&lt; endl;
      for (i=0; i&lt;3; i++) {
          strcpy (first[i], full[i]);
          if (strcmp (first[i], ", ")) {
              cout &lt;&lt; "First Name "&lt;&lt; i+1 &lt;&lt; ":" ;
              strcpy ( first[i], full[i] );
              cout &lt;&lt; (first[i]);
              cout &lt;&lt; endl;   
          }
      } 
      cout &lt;&lt; "The middle names are: " &lt;&lt; endl;
      for (i=0; i&lt;3; i++) {
          cout &lt;&lt; "Middle Name "&lt;&lt; i+1 &lt;&lt; ":" ;
          cout &lt;&lt; (middle[i]);
          cout &lt;&lt; endl;
      }
      cout &lt;&lt; "The last names are: " &lt;&lt; endl;
      for (i=0; i&lt;3; i++) {
          cout &lt;&lt; "Last Name "&lt;&lt; i+1 &lt;&lt; ":" ;
          cout &lt;&lt; (last[i]);
          cout &lt;&lt; endl;
      }
      system("pause");
      return 0;
  }
  </code></pre>