Is there a c++ function like time.sleep() in python? 10 points.?

2 Answers

Relevance
  • Anonymous
    9 years ago
    Favorite Answer

    Yes Use the dos.h header file

    and u can use sleep function .

    Usage: sleep(seconds);

  • oops
    Lv 6
    9 years ago

    In the new c++ standard, there is sleep_for:

        #include <thread>

        #include <chrono>

        int main()

        {

            std::this_thread::sleep_for(

                std::chrono::seconds(5))

        }

    If that's not available to you, boost has a version:

        #include <boost/thread.hpp>

        int main()

        {

            boost::this_thread::sleep(

                boost::posix_time ::seconds(5));

        }

Still have questions? Get your answers by asking now.