title: Alternative to system("Pause"); revisited
body: <p>I know this question has been asked a million times, but I have a coding question with it, because a couple of alternatives seem not to work with this code, and I'm not sure why.  If you look right before the return 0;, I'm trying cin.get() and it doesn't stop the program, and neither does my PressEnterToContinue() function that I found somewhere that worked on other programs.  The only thing I've gotten to work with this is system pause, which I don't want to use, since I will also be using this cross platform.  Any ideas?</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  void PressEnterToContinue()
  {
  
  std::cout &lt;&lt; "Press ENTER to continue... " &lt;&lt; std::flush;
  std::cin.ignore(std::numeric_limits &lt;std::streamsize&gt; ::max(), '\n');
  
  }
  
  int main(void)
  {
  int pause;
  double distance, x1, y1, x2, y2, x, y;
  
  cout &lt;&lt; "This program outputs the distance between two points on a plane!" &lt;&lt; endl;
  cout &lt;&lt; "Please input point X1" &lt;&lt; endl;
  cin &gt;&gt; x1;
  cout &lt;&lt; "Please input point Y1" &lt;&lt; endl;
  cin &gt;&gt; y1;
  cout &lt;&lt; "Please input point X2" &lt;&lt; endl;
  cin &gt;&gt; x2;
  cout &lt;&lt; "Please input point Y2" &lt;&lt; endl;
  cin &gt;&gt; y2;
  
  x = x2 - x1;
  y = y2 - y1;
  
  
  distance = sqrt(x*x + y*y);
  
  
  cout &lt;&lt; distance &lt;&lt; endl;
  
  //cin.get();
      //PressEnterToContinue();
      //system("Pause");
  return 0;
  
  }
  </code></pre>
  
  <p>Feel free to mention methods of stopping the system that I don't have here.  Thanks,</p>