title: How can I keep running a loop until the key is pressed (C++)
body: <p>I know this question has been asked several times on the net, but I could not find any of those answers helpful.</p>
  
  <p>I want to keep running a loop and break it once the user press a key (e.g. <code>enter</code> or <code>esc</code>). I don't want it to ask user any input <em>during</em> the process. </p>
  
  <p>I have a <code>while</code> loop.</p>
  
  <p>I am new to C++, so please answer simply.</p>
  
  <p>My system is Mac OS X.</p>