Question: I have a these kind of code in my program:

```
std :: cout << process_prompt << std :: left << std :: setw( 40 ) <<  "Looping on tree: clust_tree.";
some_function();
std :: cout << std :: string( 52, '\b' );

```

The some\_function() has a loop:

```
for( Int_t i = 0; i < n_entries; ++i ) 
{
    (some stuff...)
    if( i % 100000 == 0 )
    {
        percent_done = static_cast<float>(i) / n_entries;
        std :: cout << std :: setw( 4 ) << static_cast<int>(percent_done * 100) << "p" << std :: flush;
        std :: cout << std :: string( 5, '\b' ) << std :: flush;
    }
}

```

The process\_prompt is just a fancy way I use to write a colored message saying "Process: ".

What I expect to happen is (each row is an update of the previous):

```
Process: Looping on tree: clust_tree.            0   p
Process: Looping on tree: clust_tree.            10  p
...

```

What actually happens:

```
Process: Looping on tree: clust_tree.            0   p
12  pss: Looping on tree: clust_tree.            0   p
54  pss: Looping on tree: clust_tree.            0   p

```

Somehow my cursor is always moved to the beginnig of the line. Can someone tell me what I am doing wrong? Thank you for the reponses!

**Found the bug:**
I had some other code part which was outputting single /b characters in the loop.

Answer: 
**NOTE:** This is **not an answer** to the question, not sure this will work on the online compilers hence code for the full example here..

This full example works fine for me (c++11, gcc 4.8.2)

```
#include <iostream>
#include <chrono>
#include <thread>
#include <iomanip>

using namespace std;

int main(void) {
  cout << "Completed " << flush;
  for (auto i = 1; i <= 100; ++i) {
    cout << setw(4) << i << "%" << flush << string(5, '\b') << flush;  
    this_thread::sleep_for(chrono::milliseconds(100));
  }
  cout << endl << "Done" << endl;
}

```
Okay I seem to have found the answer, I actually had an extra '/b' for each of the loops. Thanks everyone!