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; }