第五节 · 有条不紊 · 格式化输入输出
#include <thread>
void task()
{
cout << "Hello from thread!" << endl;
}
int main()
{
// 创建并启动线程
thread t(task);
// 等待线程完成
t.join();
cout << "Main thread done" << endl;
return 0;
}习题
Last updated