title: about asking the user to input again when invalid input occurs [c++]
body: <pre><code>//User input
  cout &lt;&lt; "Please enter the property value: ";
  while (true)
  {
      cin &gt;&gt; property_value;
      if (cin.fail())
      {
          cout &lt;&lt; "Please enter the valid data." &lt;&lt; endl;
          cout &lt;&lt; "Please enter the property value again:" &lt;&lt; endl;
      }
      else
      {
          break;
      }
  }
  </code></pre>
  
  <p>I want to ask the user to reinput again when the user input the invalid data, e.g. some letters.  However when I try to run it, it keeps showing "Please enter the valid data." and "Please enter the property value again:", it enters an infinite loop.  I already check some post also about this problem, but my code is similar to them. Please help.
  P.S. sorry for my bad english.</p>