title: C++ Press Enter to Terminate Program
body: <p>I am writing a C++ program and I need to program to end/terminate after the user hits enter.
  This is what I have:</p>
  
  <pre><code>cout &lt;&lt; "Press Enter to End" &lt;&lt; endl;
  
  cin.ignore(); //ends after the user hits enter 
  
  return 0;
  </code></pre>
  
  <p>But it doesn't work. Any advice? </p>