Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 #include int main() { int time = 99;

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students also viewed these Databases questions

Question

10. Describe the relationship between communication and power.

Answered: 1 week ago