title: C++ cin keypress event
body: <p>I believe this is a very simple question, but I can't find a simple answer to it. I have an infinite loop, e.g. <code>while(1)</code>, <code>for(;;)</code>, and I need to break from the loop on a keypress. What is the easiest way to do this?</p>
  
  <p>P.S.: I can't use <code>getch</code>, <code>cin.ignore</code>, or <code>cin.get</code> because it stops the loop.</p>