Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

C/ C++time delay problem

  1. Mar 22, 2013 #1
    Hello! I was writing a basic program and was wondering about this problem:-

    when i give exit(0); the compiler exits as soon as that part of code is reached. Is there any piece of code such that after it reaches that part of code, it waits for some time before executing exit command? This can be used in case when upon exit, a message is to be displayed.

    Thank you in advance
  2. jcsd
  3. Mar 22, 2013 #2


    Staff: Mentor

  4. Mar 22, 2013 #3
    thanks! :)
  5. Mar 22, 2013 #4


    User Avatar
    Homework Helper

    In your program you could include code just before the exit(0) to display a message to indicate the user should press the enter key, then wait for user input.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook