C++ program to demonstrate example of delay() function

dos.h delay() function in C++: Here, we will learn about the delay() function of dos.h header file in C++ through a simple example/program.

delay(unsigned int milliseconds)

delay() function is used to hold the program's execution for given number of milliseconds, it is declared in dos.h header file.


void delay(unsigned int milliseconds)

Here, void is the return type of the function that means delay() will not return any value, and unsigned int milliseconds is the number of milliseconds to hold the program, delay() function accept unsigned int type of value.

Consider the program:

This program is compiled and run on TurboC3 compiler, in this program: there are delays of 1000 milliseconds (1 second) between printing of "www.", "includehelp." and ".com" then another delay to reach to getch() statement.

After that you will have to press any key to reach return 0; and program’s control will be returned (exit from program).

#include <iostream.h>
#include <dos.h> //for delay
#include <conio.h> //for getch()

int main()
	cout<<" www.";
	return 0;



There are 1 second (1000 milliseconds) delays between printing of "www.", "includehelp." and ".com"

Related Programs


Comments and Discussions!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.