title: How would i be able to code so that the computer knows the difference between a two name entry and a three name entry?
body: <pre><code>char first[20], middle[20], last[20];
  cout &lt;&lt; "Enter you name (F/M/L or F/L) \n";
  cin &gt;&gt; first;
  cin &gt;&gt; middle;
  cin &gt;&gt; last;
  </code></pre>
  
  <p>pretty simple, assignment is to write the code so that if the user enters "John smith" it will output "smith, John" and if they enter "John x. smith" it will output "smith, John x." the code here only works for 3 name entries, any way to tweak it into being able to read a two name entry while not messing up the three names?</p>