+
80
-

linux centos中c++ sleep函数怎么写?

linux centos中c++ sleep函数怎么写?

网友回复

+
0
-

用usleep() 单位是微秒(百万分之一秒)。

#include <iostream>
using namespace std;
#include <unistd.h>
int main() {

    cout << "hello\n" << endl;
    //sleep(1);
    usleep(1000000);
    cout << "world\n" << endl;

}

我知道答案,我要回答