Answers for "c++ sleep"

C++
2

how to use python sleep function on c++

// to use sleep function on windows with c++ 
#include <Windows.h>
Sleep(3000)
Posted by: Guest on January-29-2021
2

cpp thread sleep

// this_thread::sleep_for example
#include <iostream>       // std::cout, std::endl
#include <thread>         // std::this_thread::sleep_for
#include <chrono>         // std::chrono::seconds
 
int main() 
{
  std::cout << "countdown:\n";
  for (int i=10; i>0; --i) {
    std::cout << i << std::endl;
    std::this_thread::sleep_for (std::chrono::seconds(1));
  }
  std::cout << "Lift off!\n";

  return 0;
}
Posted by: Guest on December-05-2020
2

c++ sleep function

#include <chrono>
#include <thread>

std::this_thread::sleep_for(std::chrono::milliseconds(x));
Posted by: Guest on April-30-2021
1

sleep in c++ linux

#include <unistd.h>
 sleep(10);
Posted by: Guest on October-07-2020
3

sleep c++ windows

#include <Windows.h>

Sleep(number of milliseconds);
Posted by: Guest on August-14-2020
0

c++ sleep

#ifdef _WIN32
#include <Windows.h>
#else
#include <unistd.h>
#endif
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
  cout << "Hello ";
  cout.flush();
  sleep(10);
  cout << "World";
  cout << endl;
   
  return 0;
}
Posted by: Guest on October-20-2021

Browse Popular Code Answers by Language