How do I set a delay in commands? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I set a delay in commands?

Hello world, I was training my c ++ skills when the question came to me. How do I get a command to execute after a certain time? I got frustrated with searching and finding no results, I don't know if it was because I wasn't using the right words in the search, but after an hour on the web I found nothing. Until I remembered SoloLearn and here I am, I wanted to know if there is a single command that defines this waiting time and which library belongs to it. Thanks for helping me.

9th Jun 2020, 5:55 AM
João Hoffman
João Hoffman - avatar
2 Answers
+ 2
1-Use loops (not a good idea). 2-If I am correct, there should be <unistd.h> C header that you can use in C++. It has the sleep() function which causes delay for a specified amount of seconds.
9th Jun 2020, 6:23 AM
RinasSam
RinasSam - avatar
0
about the sleep () command I had seen it, but it didn't say what the library was, thanks man.
9th Jun 2020, 6:56 AM
João Hoffman
João Hoffman - avatar