Making the game Snake, studying the POP C++, and there is code:
while (true) {
snake.move ();
SLEEP (150); // delay in 150 milliseconds
}
How to make this “Sleep ()”?
OS – Linux
Answer 1, Authority 100%
https://stackoverflow.com/questions/4184468/sleep-for-milliseconds
Tools of the standard library.
# include & lt; chrono & gt;
#Include & lt; Thread & GT;
Std :: This_Thread :: Sleep_for (STD :: Chrono :: MilliseConds (X));
Answer 2, Authority 25%
In Linux there is a USLEEP ready function that “shifts” the flow to a given number of microseconds. To use it requires to connect
# include & lt; unistd.h & gt;
You can use it so
usleep (150,000);