0
How to create a timer
I am trying to program a timer that starts when you press space and stops when you press space can anybody help
6 Respostas
+ 2
You have not specified the language. Some languages have a function that checks the system clock and reports that in a time format. That information can be used to act as a start counter when spacebar event is detected.
You the do all other operations while waiting for spacebar event to happen again.
When it does you check the system clock, store the end time, compare starting time to ending time. The result is elapsed time.
If you are intending to display the time as a running time you would include the elapsed time compared to the starting time in the 'do while' process while the program waits for the spacebar event.
I apologize for the grammar in the process I have described. I tried to make it as easy as possible to translate into any computer language.
Happy codes
+ 2
Since you will be using js, you can see some examples of stopwatch programs at stackoverflow.com
Be sure to write your own code though. That will help you to understand what was done.
0
What language?
0
Sorry about that, I have not noticed that since I am a beginner. I am thinking about doing it in javascript.
0
I am trying to make a timer that like stopwatch it starts when you press space and ends when you press space. Not a countdown.. thanks
0
Ok thanks 😊👍👍👍👍