title: How do I stop program from skipping over getline?
body: <p>This is my main program, </p>
  
  <pre><code>int main () {
  
      string command;
      cin&gt;&gt;command;
  
      if(command == "keyword")
      {
          string str, str2, str3, str4;
  
          cout &lt;&lt; "Enter first name: ";
          getline (cin,str);
  
          cout &lt;&lt; "Enter last name: ";
          getline (cin,str2);
  
          cout &lt;&lt; "Enter age: ";
          getline (cin,str3);
  
          cout&lt;&lt;"Enter country: ";
          getline (cin,str4);
  
          cout &lt;&lt; "Thank you, " &lt;&lt; str &lt;&lt;" "&lt;&lt;str2 &lt;&lt;" "&lt;&lt;str3&lt;&lt;" "&lt;&lt;str4&lt;&lt; ".\n";
      }
  }
  </code></pre>
  
  <p>When keyword is entered, the program immediately outputs :</p>
  
  <p>Enter first name: Enter last name: </p>
  
  <p>completely bypassing the ability to enter the first name.</p>