Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

sleep() function in c++

+2 votes
asked Feb 15 by xufeng wang (140 points)
Why when I put the sleep(40); in my C++ program it says it's wrong.

1 Answer

+1 vote
answered Feb 28 by Peter Minarik (86,240 points)

You'll need to include the right header file:

#include <unistd.h>

But this is as C code. There are better ways to do this in C++. Check this out for various ways on how to sleep in C/C++ https://www.geeksforgeeks.org/sleep-function-in-cpp/

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...