Computer Science Canada

TIMER..... I was bored

Author:  Boarder16 [ Wed Feb 25, 2004 11:04 pm ]
Post subject:  TIMER..... I was bored

This is a timer i made.. it had a reset and counts seconds,minutes,hours,days, but i haven't ran it long enough to see hours or days work lol... bits would be appreciated for my hard programmign work and skill lol Surprised 8) 8)

code:

import GUI
var n2, n1, n3, n, nm, nm2, d1, d2 : int
n := 0
n2 := 0
n1 := 0
n3 := 0
nm := 0
nm2 := 0
d1 := 0
d2 := 0
proc reset
    n := 0
    n2 := 0
    n1 := 0
    n3 := 0
    nm := 0
    nm2 := 0
    d1 := 0
    d2 := 0
end reset
proc timer
    loop
        cls
        var res : int := GUI.CreateButtonFull (38, 300, 0, "Reset",
            reset, 0, '^R', true)
        put d2, d1, " : ", n, n1, " : ", nm2, nm, " : ", n2, n3
        put " d :  h :  m :  s"
        put " a :  r :  i :  e"
        put " y :  s :  n :  c"
        delay (1000)
        n3 := n3 + 1
        if n3 = 10 then
            n3 := 0
            n2 := n2 + 1
        else
        end if
        if n3 = 0 and n2 = 6 then
            n3 := 0
            n2 := 0
            nm := nm + 1
        else
        end if
        if nm = 10 then
            nm := 0
            nm2 := nm2 + 1
        else
        end if
        if nm = 0 and nm2 = 6 then
            nm := 0
            nm2 := 0
            n1 := n1 + 1
        else
        end if
        if n1 = 10 then
            n1 := 0
            n := n + 1
        else
        end if
        if n1 = 4 and n = 2 then
            n1 := 0
            n := 0
            d1 := 0
        else
        end if
        if d1 = 10 then
            d1 := 0
            d2 := d2 + 1
        else
        end if
    end loop
end timer
process btnact
    loop
        exit when GUI.ProcessEvent
    end loop
end btnact
fork btnact
timer

Author:  Cervantes [ Thu Feb 26, 2004 6:34 pm ]
Post subject: 

not bad.

Have you seen Zylum's clock?
It tells the real time and looks like a clock. check it out here

Author:  apomb [ Fri Feb 27, 2004 10:51 am ]
Post subject: 

nice!
i like how you integrated GUI into a seemingly boring program

Author:  the_short1 [ Sun Feb 29, 2004 8:00 pm ]
Post subject: 

..waht we make when us computer programer are bored... nice...

umm you have 8 lines of wasted code tho...

setting all variables to =0 at start/// can be done easier...

just insert line: 'reset' after you declare the procedure reset... shave off 7 liens of code...

just thought i would mention that,,,

Author:  jonos [ Sun Feb 29, 2004 8:39 pm ]
Post subject: 

that's pretty cool. nice use of gui. you should get it to correspond with the real time and have the timer as a secondary thing. like make a digital watch in turing with alarm clock, clock, stop watch, and all that stuff for the computer.

Author:  the_short1 [ Sun Feb 29, 2004 9:23 pm ]
Post subject: 

i wont plug with a link... only saying i made myself a timer for minutes with a loud beeping noise... cuz i say" ill be up in 5 mins" and it turns into 5 hours... jk Wink

your should add a beeping TIMEr to urs.. that would be cool..

Author:  valor [ Wed Mar 10, 2004 12:09 pm ]
Post subject:  cool

i think it is nice, although i am just a turing noobie i am impressed by little things. that i cannot make yet Razz

Author:  jonos [ Wed Mar 10, 2004 12:36 pm ]
Post subject: 

if you learn from compsci and turing reference, you will learn way more than what you learn in class, unless youve got an awesome compsci teacher who loves their job.

Author:  valor [ Thu Mar 11, 2004 11:00 am ]
Post subject: 

Surprised i am taking compsci at my school and im just starting to learn about algorithm's (i think thats how you spell it :p ) i am enjoying it and my teacher likes me. and i was wondering where i can find some tutorials or something to help me out.

i would appreciate any help

Author:  Paul [ Thu Mar 11, 2004 5:07 pm ]
Post subject: 

you might find them in the Turing Tutorials section here
http://www.compsci.ca/v2/viewforum.php?f=3
and since if you didn't see it, you prolly didn't access this from the index either, which is here:
http://www.compsci.ca/v2/index.php

Author:  zylum [ Thu Mar 11, 2004 7:15 pm ]
Post subject: 

thats a good begginer program. lol, but why did you even bother with days and hours Shocked lmao, it's not like anyone is going to leave it running for more than a minute Sleeping

anyways, good job

-zylum


: