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

Username:   Password: 
 RegisterRegister   
 Useful Functions and procedures...
Index -> Programming, Turing -> Turing Tutorials
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Homer_simpson




PostPosted: Thu May 08, 2003 8:28 pm   Post subject: Useful Functions and procedures...

Ok all the programming masters submit your useful procedures and functions here.....
Sponsor
Sponsor
Sponsor
sponsor
Homer_simpson




PostPosted: Thu May 08, 2003 8:38 pm   Post subject: (No subject)

Homer's first function submittion:

Ever wanted to have one command delayed in a loop and not stop other commands from running here's the function u need

code:
function timedelay (var r : int, t : int) : boolean
    var tt : int
    clock (tt)
    if r = 0 then
    clock(r)
    result false
    end if
    if tt - r >= t then
        r := tt
        result true
    else
        result false
    end if
end timedelay


and here's an example of it in use
code:
View.Set ("offscreenonly")
var time1, i, r : int := 0


loop
    if timedelay (time1, 1000) then
        i += 1
        % the rest of program is going on while the commands in this loop only work once every second
    end if

    r += 10
    drawfillarc (320, 200, 150, 150, r, r + 10, 9)
    locate (1, 1)
    put i, " seconds"
    View.Update
    cls
end loop
Catalyst




PostPosted: Thu May 08, 2003 9:28 pm   Post subject: (No subject)

i hav a library i compiled of useful fucntion/procs a while ago so i wouldnt have to hunt for them (note: not all are made by me)

Ive got this posted in submissions since there is no attachments in source Sad

MOD EDIT: I attached the file, and I'm see if I can let users attach files over here - Tony



turinglib.t
 Description:
Catalyst's function library

Download
 Filename:  turinglib.t
 Filesize:  7.91 KB
 Downloaded:  536 Time(s)

Homer_simpson




PostPosted: Thu May 08, 2003 9:36 pm   Post subject: (No subject)

wow cool functions but why didn't u send them here as an attachment?
Catalyst




PostPosted: Thu May 08, 2003 9:38 pm   Post subject: (No subject)

doesnt let you put attachments in source/tutorials
Homer_simpson




PostPosted: Thu May 08, 2003 10:16 pm   Post subject: (No subject)

Doh!!! i am so very stupid... =(
Thx tony...
Display posts from previous:   
   Index -> Programming, Turing -> Turing Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: