I'm trying to do a program. It's should take the time that is take for the user to input the whole alphabet. What kind of functions etc, should I look at.
Please don't give me finished code, I want to learn, I just need a point into the right direction.
How about having a go at all the bits you can do - say
- input a line
- validate that it is the alphabet
Then ask a specific question.
Posts which ask us to guess what you do and do not know are seldom useful.
You want to look into a threaded application (CreateThread() is a good place to start, if I remember correctly) that has one thread counting time, and the other thread accepting the input of the user. Then you want to make sure the alphabet is input correctly, possibly by using strcmp(). Make sure you stop the timer thread (after recording the right time) when the user presses enter, or you'll have the calculation time to see if the alphabet is correct added onto your user's time.
Does that help?
-tell them to enter the alphabet
-get there string
-check that its the alphabet
-print end-start for time it took
if this is for windows system
I would use timeGetTime() instead of GetTickCount() for two reasons.
1) GetTickCount() rolls over every second, so if you call GetTickCount(), and then call GetTickCount() a few seconds later - the results are meaningless.
2) It is easy to convert timeGetTime() into the amount of seconds that have lapsed, whereas GetTickCount() requires a conversion based upon the frequency of the processor.
really id idnt know that i thought there was like a 10 ms delay
or so because of when windows updates it time or something
at least thats what in understood when someone
did it, cause ive used it quite a few times and seems to
work very well.
also i never heard of timeGetTime()
do you have a quick refrence to it i could look up
i lazy dont want to google right now.
oops, I got my functions mixed up (that's what happens when you go off memory). timeGetTime() actually does the exact same thing as GetTickCount().
For some reason I got GetTickCount() confused with QueryPerformanceCounter() (Im not sure how I confused the two though since the names aren't even similar!).
lol no problem so your saying that my way is prolly a good
route then? :)
these little forgetting things are gonna kill me cause im just
learning, lol, you could of made me freak out :).
yeah, your way should work just fine :)