C++,程序休眠,暂停1s

 

#include <iostream>
#include <thread>
#include <chrono>
using namespace std;

int main()
{
    cout << "C++11" << endl;
    std::this_thread::sleep_for(std::chrono::milliseconds(100)); // 100ms
    std::this_thread::sleep_for(std::chrono::seconds(100));      // 100s

    cout << "C++14,支持字面量" << endl;
    std::this_thread::sleep_for(100ms);     // 100ms
    std::this_thread::sleep_for(100s);      // 100s

    return 0;
}

 

posted @ 2024-04-12 17:00  十一的杂文录  阅读(84)  评论(0编辑  收藏  举报