progressbar icon indicating copy to clipboard operation
progressbar copied to clipboard

Bar not updating right

Open Billkyriaf opened this issue 3 years ago • 1 comments

The bar is not updating right when the number of iterations is less than 52

Steps to reproduce:

Use the following for loop

progressbar p_bar(29);

for (int i = 0; i < 29; ++i){
    bar.update();

   // Do the work...
}

Expected Output upon completion:

[################################################] 100%

Actual output upon completion:

[   # #      # #    # # #    # #      # #    # ##] 100%

Billkyriaf avatar Nov 12 '22 19:11 Billkyriaf

Just use the update function some times, for example

int main() {
  int repeat_num = 5;
  progressbar bar(10 * repeat_num);
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < repeat_num; ++j) {
      bar.update();
    }
    // ... the program
  }
  return 0;
}

GuangchenJ avatar Jun 26 '23 11:06 GuangchenJ