【发布时间】:2017-05-07 01:39:00
【问题描述】:
我正在尝试找到一种方法来暂停或休眠我的简单 c++ 程序,例如 Python 中的 time.sleep(x)。 C ++中有等价物吗?我想在这里使用它的一个例子是:
#include <iostream>
using namespace std;
int main() {
for (int x = 0 ; x < 100 ; x++) {
cout << 100 - x << " bottles of beer on the wall, "
<< 100 - x << " bottles of beer!\nTake one down pass it around "
<< 100 - (x + 1) << " bottles of beer on the wall\n\n";
//enter sleep here to pause before next output
}
}
谢谢
【问题讨论】:
标签: c++ for-loop time sleep pause