Wait!

I'm sorry if this is in the tutorial, but I've looked to were I though it should be, and its noth there. Can some one please tell me the string of code for the program to wait a certain amount of time. Ex. A code line that makes the program wait 1 second or 2 or 3 ect.
Check out:

http://www.cplusplus.com/reference/clibrary/ctime/clock/

There's a 'wait' function written there that you can use.
Just an FYI, that will max out your CPU (one core of it at least).

If you want one that just waits, then you would need to use Sleep() (Windows) or sleep/usleep (UNIX).
try to use system sleep. for example

::sleep("1000");

include windows.h

Hope this will help you
Last edited on
Thanks guys...I was wondering if there was some 'sleep' that would simply block the thread for that time and not just hog the CPU. Sleep() relinquishes the CPU for that time period, right?
Sorry guys but nethir of those work for me. Im using Microsoft Visual C++ Express Edition, is there anyone who knows the command for it?
It's Sleep() on Windows. You might need to include windows.h to use it though.
Thank you firedraco! You have solved my problem and the code string works when I iclude windows.h
Topic archived. No new replies allowed.