cin.getline doesn't let the user to enter the value
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/10199897/cin-getline-is-skipping-an-input-in-c">cin.getline() is skipping an input in C++</a>  </p>
</blockquote>



<p>I'm working on C++, to get some data of 2 movies like the following:</p>

<pre><code>    struct Movie m1, m2;
    cout &lt;&lt; "Enter first movie title: ";
    cin.getline(m1.title, 30); 
    cout &lt;&lt; "Enter first movie director: ";
    cin.getline(m1.director, 30); 
    cout &lt;&lt; "Enter first movie length: ";
    cin &gt;&gt; m1.length; 

    cout &lt;&lt; "Enter second movie title: ";
    cin.getline(m2.title, 30);
    cout &lt;&lt; "Enter second movie director: ";
    cin.getline(m2.director, 30); 
    cout &lt;&lt; "Enter second movie length: ";
    cin &gt;&gt; m2.length;
</code></pre>

<p>But, I got surprised that in the output it doesn't all me to enter the title of the second movie. Here is the output</p>

<pre><code>Enter first movie title: Girl

Enter first movie director: GirlD

Enter first movie length: 10

Enter second movie title: Enter second movie director: Boy

Enter second movie length: 20
</code></pre>
