/**************************************************************************** * progress2.c * * Computer Science 50 * David J. Malan * * Simulates a better progress bar. * * Demonstrates \r, fflush, and sleep. ***************************************************************************/ #include #include int main(int argc, char * argv[]) { int i; /* simulate progress from 0% to 100% */ for (i = 0; i <= 100; i++) { printf("\rPercent complete: %d%%", i); fflush(stdout); sleep(1); } printf("\n"); }