| | |
Need a new time delay function!
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2008
Posts: 29
Reputation:
Solved Threads: 0
I need some help with delay functions,
First off, I know about windows.h, and the sleep(x) function.
But I can't use windows.h because it conflicts with my allegro.h causing my compiler to spew out errors from allegro.h everywhere.
Is there another function that i could use (Other than having to write out over 9000! loops to get the delay)?
First off, I know about windows.h, and the sleep(x) function.
But I can't use windows.h because it conflicts with my allegro.h causing my compiler to spew out errors from allegro.h everywhere.
Is there another function that i could use (Other than having to write out over 9000! loops to get the delay)?
0
#2 Oct 24th, 2009
Try using the <ctime> library:
http://www.cplusplus.com/reference/clibrary/ctime/time/
code for a 3 second delay:
http://www.cplusplus.com/reference/clibrary/ctime/time/
code for a 3 second delay:
C++ Syntax (Toggle Plain Text)
time_t start_time, cur_time; time(&start_time); do { time(&cur_time); } while((cur_time - start_time) < 3);
0
#3 Oct 24th, 2009
Here is another one, but it delays process.
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <ctime> using namespace std; void delay(int milliSec){ const unsigned int clk_strt = clock(); while(clock() - clk_strt < milliSec) continue; } int main(){ for(int i = 0; i < 5; i++) { delay(1000); cout<< (i+1) << " seconds has passed\n"; } }
1) What word becomes shorter if you add a letter to it?
[ Solved by : niek_e, Paul Thompson, SgtMe, murtan, xavier666, jonsca]
2) What does this sequence equal to : (.5u - .5a)(.5u-.5b)(.5u-.5c) ...
[*solved by : murtan, xavier666]
3) What is the 123456789th prime numer?![]() |
Similar Threads
- delay function (PHP)
- Time Delay Code (Python)
- time delay during program execution (VB.NET)
- Time delay (Java)
- Need help writing a delay function in C++ (C++)
- Perl- How to call an event after a time delay (Perl)
- No "Data & Time" Function (Windows 95 / 98 / Me)
- 1 do while with 2 delay (how u do that??) (C++)
- Using time in programs (C++)
Other Threads in the C++ Forum
- Previous Thread: pulling numbers from a txt file and averaging it
- Next Thread: check status of variables
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count database delete deploy developer dll download dynamiccharacterarray email encryption error file format forms fstream function functions game generator givemetehcodez graph gui homeworkhelp iamthwee ifstream image input int java lib library linker list loop looping loops map math matrix memory multiple newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg simple sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






