作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
好吧,我可以暂停,问题是我所有的“暂停”都是累积的,而不是按顺序完成的。我尝试了很多时钟的东西, sleep ,..每次都有相同的结果。我在这里错过了什么吗?我只是想这样做来帮助我通过视觉反馈进行编程,它不会保留在代码中,所以任何东西,即使是肮脏的东西,都是受欢迎的!
void Dockable::resize_cells() {
for (int i = 0; i < cells.size(); i++) {
for (int j = 0; j < cells[i].size(); j++) {
if (cells[i][j] != layout) {
if (cells[i][j]->is.docked) {
int found_col = 0;
bool found = false;
int pos = 0;
for (int k = 0; k < cells.size(); k++) {
int col = 0;
for (int l = 0; l < cells[k].size(); l++) {
if (!found) {
if (cells[i][j] == cells[k][l]) {
found = true;
pos = col;
}
}
if (!(l - 1 < 0) &&
cells[k][l] != cells[k][l - 1]) {
col++;
}
else {
col++;
}
if (found) {
if (col > found_col) {
found_col = col;
}
}
}
}
cells[i][j]->x_size(layout->x_size() / found_col);
cells[i][j]->x((layout->x_size() / found_col) * pos);
cells[i][j]->refresh_shape_apply();
wait();
}
}
}
}
}
void Dockable::wait()
{
clock_t counter;
clock_t target;
counter = clock();
target = clock() + 100;
while (counter < target) {
counter = clock();
std::cout << counter << std::endl;
}
}
refresh_shape_apply,应用转换,因为它是在等待之前执行的,我希望它能起作用。
最佳答案
您可以使用此代码
system("pause");
这可以帮助暂停代码,直到您按任意字母继续。
关于c++ - 如何在 for 循环内暂停,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59464237/
我是一名优秀的程序员,十分优秀!