Sep 01, 2009 First of all, do not use an 'empty time delay loop' as that will be extremely system dependent and unreliable. Also, it would help to know what OS you are developing for and what errors you are receiving when your try to use Sleep or delay. Also, for very precise timing, you may want to take a look at this library. Jan 10, 2017 Since dev-cpp keeps seperate compiter Mingw while Tubo-c was using Borland. However there are several ways to implement/use delay function in cpp code. First way: code#include void delay(int delay) int now=time(NULL); int later=now+.
Delay in C: delay function is used to suspend execution of a program for a particular time.
Declaration: void delay(unsigned int);
Here unsigned int is the number of milliseconds (remember 1 second = 1000 milliseconds). To use delay function in your program you should include the 'dos.h' header file which is not a part of standard C library.
Delay in C program
If you don't wish to use delay function then you can use loops to produce delay in a C program.
#include<stdio.h>int main()
{
int c, d;
for(c =1; c <=32767; c++)
for(d =1; d <=32767; d++)
{}
return0;
}
{
int c, d;
for(c =1; c <=32767; c++)
for(d =1; d <=32767; d++)
{}
return0;
}
We have not written any statement in the loop body. You may write some statements that doesn't affect logic of the program.
C programming code for delay
#include<stdio.h>#include<stdlib.h>
![Função Delay Dev C++ Função Delay Dev C++](/uploads/1/2/6/6/126634403/528389018.jpg)
main()
{
printf('This C program will exit in 10 seconds.n');
{
printf('This C program will exit in 10 seconds.n');
delay(10000);
Dev C++ Download Windows 10
return0;
}
}
This C program exits in ten seconds, after the printf function is executed the program waits for 10000 milliseconds or 10 seconds and then it terminates.