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)?

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by firstPerson
0

Here is another one, but it delays process.

#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";
	}
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.