C++ changing output on console
When I’ve needed that I have just output a carriage return character, in C++ \r
.
Remember to flush the output each time, e.g.
cout << "\r" << x << "% completed. " << flush;
The spaces at the end to clear previous output on the line in case of Microsoft-like fluctuating progress.
Use the backspace character.
cout << "10%";
// ...
cout << "\b\b\b20%";