I'm trying to incorporate a sort of progress bar in my program.
I thought this might be easily accomplished by printing on screen the percentage of the number of iteration my program has carried out. However I've stumbled upon an issue.
cout << (double) ( j / n * 100 ) << "%";
In the above simple line of code, I'm printing the percentile progress every iteration j of my program. This unfortunately does not overwrite the previous percentage displayed, so I get a succession of percentages. I can add a endl and then this will happen every line, but this is not what I want.
I would like the output of the above cout to overwrite the previous value, so that it looks like the percentile progress is updating itself.
Could someone help or point me in the right direction for this one?