Problem with consecutive cin's
<pre><code>#include&lt;iostream&gt;

int main()
{
    int x, y;
    cin &gt;&gt; x ;  
    cin &gt;&gt; y ;   // This gets ignored
}
</code></pre>

<p>Hi 
in above prog after pressing Ctrl-D during first cin second cin gets ignored. how i can make second cin work after pressing ctr-D during first cin. cin.ignore() and cin.clear() doesn;t seem to work.</p>

<p>My question is that if im pressing ctrl-D during first cin bascially i am leaving eof char in i/p stream which is not going to be read and it reamins there. now can't i remove this character from the stream so that it's  ready again for input. if not what's the exact reason behind it. </p>
