Question
Using c, Please hurry I need help please. create a countdown timer that allows the timer to be updated before reaching 0 by using threads.
Using c,
Please hurry I need help please.
create a countdown timer that allows the timer to be updated before reaching 0 by using threads.
When the timer reaches 0 then the timer will terminate.
Here is a code, modify the program so that it can update the timer when for example user input 90 and the timer will reset to 90 and countdown by 1 seconds each time. Please add threads to this program.
Use sleep to make the timer wait 1 sec
The initial value of timer will start at 80
Use main thread so that it will display the count
Use subthreads to read when there is keyboard entry.
#include
do { printf(" %d seconds left",time); time--; sleep(1); fflush(stdout); } while(time>0);
printf(" Terminating because timer reaches 0 "); return(0); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started