title: How can I clear the input buffer in a c++ application?
body: <p>I make a lot of simple console c++ applications and one problem I am facing is the input buffer. I have tried cin.ignore and flush(), but they don't seem to be working for me.</p>
  
  <p>If I have code such as:</p>
  
  <pre><code>cin &gt;&gt; char1;
  cin &gt;&gt; char2; 
  </code></pre>
  
  <p>and I press: 1 (space) 2 (Enter), with just one enter, the 1 is stored to char1 and the 2 is stored to char2.</p>
  
  <p>Sorry if I am a little fuzzy on what I am asking. I will try to edit this question if people don't understand.</p>