-
time reaction game
I need to create a piece of code that starts a timer and stops when a key is hit, and then displays how far away from 2.5 seconds that the key was hit. It needs to do this 4 times. I can use the clock() and kbhit() functions. The only problem is I can't reset the counter to ZERO for each time. If anyone understands and can help... please do. Thanks!
-
Instead of reseting the counter save the value of when they first hit it and subtract that from the current time.
Like:
Code:
// ...
double previous_time;
double current_time;
// do whatever to get the times;
current_time -= previous_time;
// that will give you how long it took from the first press to the second one.
Hope that helps and makes sense.
-
that might help but...
I have to display the time continually...
-
Thanks dude, that helped.