Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 timer
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
susan_101




PostPosted: Thu Jan 20, 2005 8:22 pm   Post subject: timer

umm how would i create a timer that stops my program after like a minute or something liek that Sad heelp
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Thu Jan 20, 2005 8:37 pm   Post subject: (No subject)

code:

loop
  exit when Time.Elapsed > (1000 * 60) %1000 milliseconds per second.  60 seconds per minute.
end loop
susan_101




PostPosted: Thu Jan 20, 2005 8:52 pm   Post subject: (No subject)

hmm but this part of the program doesnt happen until later so wouldn't time.elpased not be accurate..i mean what if the user gets to this part around 30 seconds and the timer woul dbe 30 seconds ahead already :/
Andy




PostPosted: Thu Jan 20, 2005 8:53 pm   Post subject: (No subject)

post some code so we have something to work with plz
susan_101




PostPosted: Thu Jan 20, 2005 8:57 pm   Post subject: (No subject)

code:





randint (random3, 1, 3)
var answer : int
var random : int
var random2 : int
var reply : string



loop
   
    locate (1, 1)
   
    randint (random, 1, 12)
    randint (random2, 1, 12)

    put random, "*", random2

    loop
        locate (3, 1)
        get answer
        if answer not= random * random2 then
            put "Wrong, deducting money"
            locate (3, 1)
            put "       "
            locate (5, 1)
            put "         "
        else
            locate (3, 1)
            put "        "
            locate (4, 1)
            put "                "
            put "Caught it"
            exit
        end if
    end loop

     
end loop
susan_101




PostPosted: Thu Jan 20, 2005 8:58 pm   Post subject: (No subject)

basically its a math game and theh user only has a certain amount of time to do it until time runs out
Andy




PostPosted: Thu Jan 20, 2005 8:59 pm   Post subject: (No subject)

Oooo then u'd need a clock to do it... type clock, then press F9 in the turing editor.. if u still have trouble, post your new code and then we'll help you through it
susan_101




PostPosted: Thu Jan 20, 2005 9:00 pm   Post subject: (No subject)

aite t ill try it out
Sponsor
Sponsor
Sponsor
sponsor
susan_101




PostPosted: Thu Jan 20, 2005 9:02 pm   Post subject: (No subject)

nvm i got it thznk
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 9 Posts ]
Jump to:   


Style:  
Search: