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 @   十一的杂文录  阅读(146)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· [翻译] 为什么 Tracebit 用 C# 开发
· Deepseek官网太卡,教你白嫖阿里云的Deepseek-R1满血版
· 2分钟学会 DeepSeek API,竟然比官方更好用!
· .NET 使用 DeepSeek R1 开发智能 AI 客户端
· 刚刚!百度搜索“换脑”引爆AI圈,正式接入DeepSeek R1满血版
点击右上角即可分享
微信分享提示