Computer Science Canada

delays like turing

Author:  hamid14 [ Tue Apr 20, 2010 10:58 am ]
Post subject:  delays like turing

Is there anyway to put in delays in dev-c++ like in turing? Thanks, im new to c++ btw.

Author:  chrisbrown [ Tue Apr 20, 2010 11:07 am ]
Post subject:  RE:delays like turing

To pause execution for 1 second:

On windows:
code:
#include <windows.h>

int main() {
    Sleep(1000);
}


On *nix:
code:
#include <unistd.h>

int main() {
    sleep(1000);
}


Note the case difference in s/Sleep.

Author:  hamid14 [ Wed Apr 21, 2010 7:13 am ]
Post subject:  Re: delays like turing

i dont want it to stop completely for 1 second, i want it to slow down so I can actually see the numbers decreas on screen in the cmd. Thanks for the sleep function though, will use it. Smile

Author:  chrisbrown [ Wed Apr 21, 2010 11:42 am ]
Post subject:  RE:delays like turing

That's what both sleep and delay do, they pause execution. You can't tell a computer to go slower, it executes instructions as fast as it is capable.

Author:  BigBear [ Wed Apr 21, 2010 2:26 pm ]
Post subject:  RE:delays like turing

Turbo button?

Author:  hamid14 [ Wed Apr 21, 2010 3:24 pm ]
Post subject:  Re: delays like turing

oh ok, I understand. Thanks for the info. guys! Surprised


: