我想添加一个延迟,这样一行将运行,然后在短时间延迟后,第二行将运行。我对C++相当陌生,所以我不知道我会怎么做。因此,理想情况下,在下面的代码中,它会打印“加载.”等待至少1-2秒,然后打印“加载.”再来一次。目前,它同时打印两个,而不是等待。
cout << "Loading..." << endl;
// The delay would be between these two lines.
cout << "Loading..." << endl; 发布于 2017-09-15 08:58:02
在windons操作系统中
#include <windows.h>
Sleep( sometime_in_millisecs ); // note uppercase S在中
#include <unistd.h>
unsigned int sleep(unsigned int seconds);
#include <unistd.h>
int usleep(useconds_t usec); // Note usleep - suspend execution for microsecond intervalshttps://stackoverflow.com/questions/46230710
复制相似问题