0
C++ PAUSE
Is there a way to make a block of code waiting before it will be executed, for example a library? How to use it? I tried with __TIME__ variable but once the code is written and executed the first time the value of __TIME__ is the same every time I execute it.
5 Réponses
+ 1
__TIME__ is a string litral containing the time of compilation in the form of hh:mm:ss.
You can't use it for that problem.
system("PAUSE"); works on Windows only so it'll make the code platform dependent.
Emulating the effect of pause by wasting CPU time through using a loop is an inefficient way to work around the problem but it doesnt work on SL.
Also using cin.get() would be another trick.
I can't think of any other way to work around the problem.
+ 4
OrHy3 go through these posts :
code playground can give time limit error👍hope it helps...
http://www.cplusplus.com/reference/thread/this_thread/sleep_for/
https://stackoverflow.com/questions/14315497/how-to-get-current-date-time-of-the-system-in-seconds
0
OrHy3 What must wait your program? Static libraries are linked to compile time (hence no wait in execution)... Can you say what your program must wait?
0
I 've already found the answers thanks to Daljeet Singh. KrOW, I mean programs that need to wait a certain number of seconds, such as a timer
0
OrHy3 Ok.... Because you have found a solution, would it good if you mark Daljeet Singh like best answer for future readers