DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Thread: Reaction Times

  1. #1
    Mediri Guest

    Reaction Times


    I'm trying to create a program that would display the reaction time of a person
    reaction to an object on the computer. I don't know how to write this code.
    Suggestions would be great.

  2. #2
    Danny Kalev Guest

    Re: Reaction Times

    First of all, you want to post technical questions on the c++.general
    ng. Anyway, depending on the stimulus you intend to present, say a
    character, a number or a string, you can do something like the
    following:

    char c;
    cout<<"press a key immediately after the stimulus has been shown"<<endl;
    cout << stimulus <<endl;
    // here you start counting time
    // see:
    http://gethelp.devx.com/techtips/cpp.../10min1200.asp
    time_t start=time()
    cin>>c;
    time_t end = time();
    double reaction_time=difftime(end,start);


    If it's likely that the reaction time is shorter than a second, you want
    to use the clock() function or the follwoing class:
    http://gethelp.devx.com/techtips/cpp.../10min0500.asp

    Danny



    Mediri wrote:
    >
    > I'm trying to create a program that would display the reaction time of a person
    > reaction to an object on the computer. I don't know how to write this code.
    > Suggestions would be great.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links