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

Username:   Password: 
 RegisterRegister   
 program waiting
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
flameZero




PostPosted: Fri Jun 09, 2006 7:36 am   Post subject: program waiting

hey guys its me again.... Confused Embarassed
my program is going smoothly (for now) and i have to thank all of you...


but lets get to business............ i have another question......
id like my program to wait a second or two (depending on the user action), how do i do that?
i was thinking 2 second wait before attacking..2.5 seconds before defending, 2 seconds before enemy retaliation....etc
can u help me out?
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Sat Jun 10, 2006 3:30 pm   Post subject: (No subject)

Before you do something like this, think: "Do I truly need this delay for my program to work?" I'm thinking, since this is probably text based, the answer is no.
AnubisProgrammer




PostPosted: Wed Jun 21, 2006 1:50 pm   Post subject: (No subject)

all you have to do is make sure windows.h and conio.h are included, then use:
Sleep(n);
n=number of milliseconds it will wait for.
so, if you have:
Sleep(1000);
it will wait for 1000 milliseconds, or, 1 second.
so to wait for 2 seconds it would be Sleep(2000), 2.5 seconds is Sleep(2500).

The 'S' must be capitolized on Sleep.

ps. you might just need conio.h, I'm not sure if you need windows.h.
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  [ 3 Posts ]
Jump to:   


Style:  
Search: