cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Timer whilst typing, any help??
Timer whilst typing, any help??
Jul 11, 2012 at 5:10pm UTC
Mr Pteo
(2)
So i was playing around making a sort of console style game today, but i met a problem that i can't seem to figure out.
I need my code to accept input via
cin
but also count down/up to a specified number.
then im going to have an if statement saying:
1
2
3
if
(timervariable > 0){ cout <<
"Well done"
; }
Hope you understand me, and are able to help.
Jul 11, 2012 at 5:13pm UTC
Computergeek01
(5613)
You
could
keep a timer going with another thread, but it's far easier to just take a time stamp when the question is presented and another one after the user enters their answer, the difference between the two is the amount of time elapsed.
Jul 11, 2012 at 5:21pm UTC
Mr Pteo
(2)
the timestamp idea sounds good, i haven't a clue how to do this so time to utilize google. Thanks for the help.
Jul 11, 2012 at 5:35pm UTC
dawtsf1187
(43)
I did something similar a while back. I don't remember the details, but I believe I used
#include <time.h>
I think if you look up that header on this site, you can find some helpful info. Good luck.
Topic archived. No new replies allowed.