Coding Global Background
Coding Global

Timed Input

Archiviert 2 years ago
1 Nachrichten
0 Mitglieder
Erstellt 2 years ago
Aktualisiert 2 years ago
In Discord öffnen
W
FreeKayD
Is there anyone That is familiar with C++ at the moment i need help with a countdown type program
I already have my code counting down but i want it to stop when the user inputs something into a variable
what i have so far
int seconds=5;
int user; while(seconds>0) { cout<<"\r0"<< seconds; fflush(stdout); clock_t stop = clock() + CLOCKS_PER_SEC; while(clock()<stop){} seconds--; } cout<<"\rBOOM!"; }
wanna add the user function somewhere in the loop where it stops it when a value has been passed to it

Antworten (1)