title: C++ on Windows - the console window just flashes and disappears. What's going on?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1775865/visual-studio-console-app-prevent-window-from-closing">Visual Studio Console App - Prevent window from closing.</a>  </p>
  </blockquote>
  
  
  
  <p>I'm starting to learn C++ on Windows and I'm trying a few different development environments:
  1. Netbeans with Cygwin compiler
  2. MS Visual Studio 2010</p>
  
  <p>For either of them, when I write a very simple Hello World program, I build it and it's fine. But when I try to run the program, the command prompt window pops up really quick and then disappears right away.</p>
  
  <p>This happens whether it's in Debug or Release config. Please help with this - I can't see my program output! :(</p>
  
  <p>Thanks.</p>
  
  <p>EDIT1:
  Thanks for the replies. This is my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  int main()
  {
      std::cout &lt;&lt; "This is a test." &lt;&lt; std::endl;
      return 0;
  }
  </code></pre>
  
  <p>I tried Ctrl+F5 for "Start without Debugging" and that doesn't work. It still flashes the black console screen then disappears right away.</p>
  
  <p>I also tried adding in std::cin.get(); and this works with Ctrl+F5, but isn't that a really... inelegant workaround solution? I'd rather have my program in the final form.</p>
  
  <p>The breakpoint works, but then I have to run with debugging and the console window flashes and disappears, but then it stays in the background. Any way to get the console to stay in the foreground so I can see program output right away? Seems like that's how it should work.</p>
  
  <p>Any more ideas? Why wouldn't Ctrl+F5 work? </p>