0

How to add a delay in Code Playground.

I want to insert an delay of x seconds and then print the next statement. Please list the header file and the pseudo code for usage. Thanks!

28th Oct 2016, 8:21 AM
Anbu Coder
Anbu Coder - avatar
5 Antworten
+ 5
You can't do that in C++ on the code playground. The way it works is that it compiles and executes the program on a remote server, and when it finishes (or after a time limit is reached), the output is sent to us. But you can do that in javascript for example, since the code runs client-side.
28th Oct 2016, 10:05 AM
Zen
Zen - avatar
+ 1
There is function called sleep() in dos.h. It will help
28th Oct 2016, 12:15 PM
durgesh majeti
durgesh majeti - avatar
0
Use a loop.
28th Oct 2016, 9:30 AM
Misha Vinokurov
Misha Vinokurov - avatar
0
use loop.... (not sure that it will work out not) for(int I=0;I<35000;I++);
28th Oct 2016, 9:48 AM
Rohit Kaushal
Rohit Kaushal - avatar
0
@Zen Thanks! I made a code 'Get your starter pokemon' and I wanted to print two statement and then a delay before printing the final statement which would declare which Pokémon the user got. But I guess I can't do anything about it. :( (At least not in C++) @Rohit @Misha Thanks for your response too.
28th Oct 2016, 10:18 AM
Anbu Coder
Anbu Coder - avatar