title: C++ cin whitespace question
body: <p>Programming novice here. I'm trying to allow a user to enter their name, firstName middleName lastName on one line in the console (ex. "John Jane Doe"). I want to make the middleName optional. So if the user enters "John Doe" it only saves the first and last name strings. If the user enters "John Jane Doe" it will save all three.</p>
  
  <p>I was going to use this:</p>
  
  <pre><code>cin &gt;&gt; firstName &gt;&gt; middleName &gt;&gt; lastName;
  </code></pre>
  
  <p>then I realized that if the user chooses to omit their middle name and enters "John Doe" the console will just wait for the user to enter a third string... I know I could accomplish this with one large string and breaking it up into two or three, but isn't there a simpler way to do it with three strings like above?</p>
  
  <p>I feel like I'm missing something simple here...</p>
  
  <p>Thanks in advance.</p>