Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 delays like turing
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
hamid14




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
chrisbrown




PostPosted: 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.
hamid14




PostPosted: 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
chrisbrown




PostPosted: 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.
BigBear




PostPosted: Wed Apr 21, 2010 2:26 pm   Post subject: RE:delays like turing

Turbo button?
hamid14




PostPosted: Wed Apr 21, 2010 3:24 pm   Post subject: Re: delays like turing

oh ok, I understand. Thanks for the info. guys! Surprised
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: