title: Wait until user presses enter in C++?
body: <pre><code>waitForEnter() {
      char enter;
  
      do {
          cin.get(enter);
      } while ( enter != '\n' );
  }
  </code></pre>
  
  <p>It works, but not always. It doesn't work when an enter is pressed just before the function is called.</p>