Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2008
    Posts
    2

    How to get "Press any key to continue"

    Hi,

    I am going through the VTMs on C++ with great interest - they are just fantastic. But I can't get my code to automatically pause and keep the console window open with a "Press any key to continue" as in the tutorials. Instead, I have had to add code to declare an integer variable "zz" and then put in the line of code:

    cin >> zz;

    to force the program to wait for keyboard input.

    I'm using Microsoft Visual Studio 2005. Maybe it's an option in settings somewhere to have the console application pause on completion?????

  2. #2
    Join Date
    Feb 2005
    Location
    Bellevue, WA
    Posts
    3,251
    Press CTRL+F5 instead of F5 to run the program.

    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." ~Rich Cook

  3. #3
    Join Date
    Nov 2006
    Location
    UK
    Posts
    3,774
    I was surprised this wasnt in the thread of information - so Ive added it.. Sure, I could be more wordy, but hey, its a start.
    Delphi !ROCKS!
    Got a question? Read this first!!!
    "You gotta help us, Doc. We've tried nothin' and we're all out of ideas"

  4. #4
    Join Date
    Feb 2005
    Location
    Bellevue, WA
    Posts
    3,251
    You should add a note about F5 starting the debugger and CTRL+F5 not since you're adding it to the TOI.

    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." ~Rich Cook

  5. #5
    Join Date
    Oct 2008
    Posts
    2
    Thank goodness for forums! I would have searched for a long time to find the answer. I knew it had to be something pretty simple that I just didn't know. Thanks a lot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •