For completions sake:
#include <iostream>
using namespace std;
int main() {
for (uint i = 0; i <= 100; ++i) {
cout << "\rProgress: " << i << "%" << flush;
for (uint j = 0; j < 9999999; ++j); // pause
}
cout << endl;
return 0;
}
#include <iostream>
using namespace std;
int main() {
for (uint i = 0; i <= 100; ++i) {
cout << "\rProgress: " << i << "%" << flush;
for (uint j = 0; j < 9999999; ++j); // pause
}
cout << endl;
return 0;
}
To copy to clipboard, switch view to plain text mode
\r means carriage return. Without a \n, it just takes the cursor back to the beginning of the current line. flush flushes the buffer.
Bookmarks