0

So I've managed to make the countdown clock in which changes the console text only by flushing out the line using "\r"

end = 120;  
for (end; end >=0; end--){
    printf("\r");
    int num = end / 60;
    int nums = end % 60;

    printf(" %d : %.2d ", num, nums);
    sleep(1);

    if(num == 0 && nums == 0){
        printf("\n\nTIME'S UP!    GAMEOVER!");
        sleep(2);
    }
}

However when I do this I can't use any input, obviously having "scanf" would interupt the flow of the time loop... is there any other way I could get a dynamic changing text in the console while inputting other text?

Alex
  • 17
  • 4

1 Answers1

0

I don't think so. The console is like an old tape that can only be used from start to end. Indeed, you cheat it a litle with your use of '\r'.

NoirDelire
  • 59
  • 5