How does cin work?
<p>I ran this code</p>

<pre><code>char c;
cin &gt;&gt; c;
cout &lt;&lt; c;
cin &gt;&gt; c;
cout &lt;&lt; c;
</code></pre>

<p>and wrote to the console <code>ab</code>, the pressed enter. So I got <code>ab</code> at the next line. But I can't understand how it works. Before pressing enter the program doesn't read anything, right? After pressing, it reads <code>a</code>, save it to <code>char c</code>, then reads <code>char c</code>, writes <code>a</code> to the console. It's OK. But how can it read <code>b</code> being at the second line? It isn't <code>b</code> at the second line</p>