title: C++ Why does this work
body: <p>I am using Microsoft Visual studio 2013</p>
  
  <p>I currently have this switch statement:</p>
  
  <pre><code>switch (option)
  {
          case 1:
              getline(cin, newname);
              cout &lt;&lt; "What would you like your new username to be?\nName: ";
              getline(cin, newname);
              name = newname;
              cout &lt;&lt; "\nYour username is now '" &lt;&lt; name &lt;&lt; "' with your balance being $" &lt;&lt; balance &lt;&lt; "\n";
              options();
              break;
          case 2:
              cout &lt;&lt; "\nOpenning cheat menu\n";
              cheats();
              break;
          default:
              cout &lt;&lt; "\nExitting to main title...\n";
              title();
              break;
  }
  </code></pre>
  
  <p>you can just ignore the case 2 and default, just showing so you know that those cases work. Case 2 and default work perfectly fine but case 1 is acting weird. As you can see on case 1 I have two getline(cin, newname); You may think I should only have one, but for some reason I need two for this code to function correctly.</p>
  
  <p>If I only have one of these the code jumps past the input the user should give. If I have two it works normally.</p>
  
  <p>I have asked someone this and they do not understand either, so therefore: Why does this work.</p>