Computer Science Canada program waiting |
Author: | flameZero [ Fri Jun 09, 2006 7:36 am ] |
Post subject: | program waiting |
hey guys its me again.... ![]() ![]() 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? |
Author: | [Gandalf] [ Sat Jun 10, 2006 3:30 pm ] |
Post 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. |
Author: | AnubisProgrammer [ Wed Jun 21, 2006 1:50 pm ] |
Post 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. |