title: getline function not working with multiple string input
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1744665/need-help-with-getline">Need help with getline()</a>  </p>
  </blockquote>
  
  
  
  <p>I'm trying to use the getline function in conjunction with cin to get input from the keyboard but my code skips over the getline statement and instead proceeds to cin function below. Here is my code and a screenshot of what is happening.</p>
  
  <p><img src="https://i.stack.imgur.com/jReIY.jpg" alt="enter image description here"></p>
  
  <pre><code>void addmovie(ofstream&amp; MovieContentsFile) {
  
  string movieTitle;
  int movieQuantity;
  
  cout &lt;&lt; " \n Add Movie Selected \n " &lt;&lt; endl;
  
  cout &lt;&lt; "Please type in the movie title and press enter \n" &lt;&lt; endl;
  
  getline(cin,movieTitle, '\n');
  
  cout &lt;&lt; "Movie: " &lt;&lt; movieTitle &lt;&lt; "Please type in the amount of copies we have of this movie \n " &lt;&lt; endl;
  
  cin &gt;&gt; movieQuantity;
  </code></pre>
  
  <p>I'd appreciate an explanation of why this is happening and how I can avoid it in the future</p>