Point me!

This is a discussion on Point me! within the C++ Programming forums, part of the General Programming Boards category; I'm trying to do a program. It's should take the time that is take for the user to input the ...

  1. #1
    Interested Newbie
    Join Date
    Sep 2004
    Location
    Sweden
    Posts
    51

    Point me!

    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.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,855
    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.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313
    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?

  4. #4
    Banned
    Join Date
    Aug 2004
    Posts
    128
    do this

    -tell them to enter the alphabet
    -GetTickCount()
    -get there string
    -GetTickCount()
    -check that its the alphabet
    -print end-start for time it took

    if this is for windows system

  5. #5
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,265
    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.

  6. #6
    Banned
    Join Date
    Aug 2004
    Posts
    128
    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.

  7. #7
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,265
    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!).

  8. #8
    Banned
    Join Date
    Aug 2004
    Posts
    128
    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 .

  9. #9
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,265
    yeah, your way should work just fine

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help realy needed
    By ZohebN in forum C++ Programming
    Replies: 2
    Last Post: 04-08-2008, 10:37 AM
  2. Getting a floating point exception
    By SnertyStan in forum C Programming
    Replies: 13
    Last Post: 03-25-2008, 12:00 PM
  3. How to monitor process creation?
    By markiz in forum Windows Programming
    Replies: 31
    Last Post: 03-17-2008, 03:39 PM
  4. floating point binary program, need help
    By ph34r me in forum C Programming
    Replies: 4
    Last Post: 11-10-2004, 07:10 AM
  5. point lies in circle?
    By cozman in forum Game Programming
    Replies: 3
    Last Post: 12-20-2001, 04:39 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21