title: While statement won't stop
body: <p>I have a while statement that keeps repeating the text without giving the user a chance to input another value for action. What am I doing wrong? It still doesn't ask for input. I need for the code to display the text once, then ask for input. Presumably, if you typed anything but 1 it would repeat the sequence. But as it stands it simply kicks you out of the loop without the chance to correct the action (As of the last edit, see below.)</p>
  
  <pre><code>int action = 0;
  while (action != 1)
  { 
      cout &lt;&lt; " No you must look it might be dangerous" &lt;&lt; endl;
      cin &gt;&gt; action;
  }
  </code></pre>
  
  <p>One suggestion was:          </p>
  
  <pre><code>while (action != 1)
  { 
      cout &lt;&lt; " No you must look it might be dangerous" &lt;&lt; endl;
      cin &gt;&gt; action;
      cin.ignore();
  }
  </code></pre>
  
  <p>That still produces text over and over.</p>
  
  <pre><code>while (action != 1)
  { 
      cout &lt;&lt; " No you must look it might be dangerous" &lt;&lt; endl;
      if (!(cin &gt;&gt; action))
          // ...problems in the I/O stream...
          break;
  }
  </code></pre>
  
  <p>This one kicks you out without a chance to input a new action.</p>