Coding Global Background
Coding Global

Timed Input

Archived 2 years ago
1 messages
0 members
Created 2 years ago
Updated 2 years ago
Open in Discord
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

Replies (1)