why std::cin in step 3 is omitted?
<p>I don't understand, why <code>cin &gt;&gt; W;</code> in step 3 is omitted, if i input not a number (i.e. 's').</p>

<pre><code>#include &lt;cstdlib&gt;
#include &lt;iostream&gt;

using namespace std;

int main(int argc, char *argv[])
{
  short W = -1;

  cout &lt;&lt; "step 1) W = " &lt;&lt; W &lt;&lt; endl;
  cout &lt;&lt; "give a number: ";
  cin &gt;&gt; W;

  if ( cin.fail() )
  {
    cout &lt;&lt; "ERROR, bad number" &lt;&lt; endl;
    W = -1;

    cout &lt;&lt; endl &lt;&lt; "step 2) W == " &lt;&lt; W &lt;&lt; endl;
    cin.clear();
  }

  cout &lt;&lt; endl &lt;&lt; "step 3) W == " &lt;&lt; W &lt;&lt; endl;
  cout &lt;&lt; "give a number: ";
  cin &gt;&gt; W;

  cout &lt;&lt; endl &lt;&lt; "step 4) W == " &lt;&lt; W &lt;&lt; endl;

  system("PAUSE");
  return EXIT_SUCCESS;
}
</code></pre>
