title: getline() does not work if used after some inputs
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><code>getline()</code> is not working, if I use it after some inputs, i.e. </p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  
  main()
  {
  string date,time;
  char journal[23];
  
  
  cout&lt;&lt;"Date:\t";
  cin&gt;&gt;date;
  cout&lt;&lt;"Time:\t";
  cin&gt;&gt;time;
  
  cout&lt;&lt;"Journal Entry:\t";
  cin.getline(journal,23);
  
  
  cout&lt;&lt;endl;
  system("pause");
  }
  </code></pre>
  
  <p>where as if I use <code>getline()</code> on top of inputs, it does work i.e.</p>
  
  <pre><code>cout&lt;&lt;"Journal Entry:\t";
  cin.getline(journal,23);
  cout&lt;&lt;"Date:\t";
  cin&gt;&gt;date;
  cout&lt;&lt;"Time:\t";
  cin&gt;&gt;time;
  </code></pre>
  
  <p>What might be the reason? </p>