I want to print 0 to 9 in an interval of 1 sec between each number AND the previous number must be overwritten.
i.e. The numbers should be printed at the same location on the screen. But this is not working. Here is my code:
Code:#include <iostream> #include <unistd.h> using namespace std; int main() { int i = 0; for(i=0; i<10; i++) { cout << i; sleep(1); cout << '\b'; } return 0; }



LinkBack URL
About LinkBacks


