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

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




PostPosted: Thu Dec 11, 2003 4:36 pm   Post subject: procedures

is it possible to add your own procedures to turing, so they are always declared and can be used in program by calling them?

for example, Draw.Line procedure is already made, you just have to call it....can i do this with one of the procedures i have made?
Sponsor
Sponsor
Sponsor
sponsor
AsianSensation




PostPosted: Thu Dec 11, 2003 4:48 pm   Post subject: (No subject)

sure, compile a list of whatever stuff you need, and then just include the file in the beginning of your program, acts like a header file.

If im not mistaken, then there are some useful functions already made that you can include here at compsci.

btw, to include, type it

code:
include
DanShadow




PostPosted: Thu Dec 11, 2003 5:10 pm   Post subject: ..

I know what im about to do is kind of like helping him cheat...but it isnt really much to cheat for....so here it is. This code will be able to call upon a "draw_line" procedure as many times as needed, so its looped to prove that point. I hope this helps
code:

var x, y, x2, y2 : int := 0

%Makes a procedure that clears the screen, and draws a line
procedure draw_line
    Draw.FillBox (0, 0, maxx, maxy, 0)
    Draw.Line (x, y, x2, y2, 255)
end draw_line

loop
    %Asks user for (x,y) values of the line
    locate (1, 1)
    put "Enter the first x and y co-ordinates seperated by a space: "
    get x
    get y
    put "Enter the second x and y co-ordinates seperated by a space: "
    get x2
    get y2

    %Runs the draw_line procedure, and draws the line
    draw_line

end loop
Thuged_Out_G




PostPosted: Thu Dec 11, 2003 10:53 pm   Post subject: (No subject)

ok dan, i know how to make procedures and call them
what i was asking was:
i was wonering if it is possible tomake a procedure, and save it somewhere so i can call it in any program withhout declaring it...like the draw procedures already available in turing, you just have to call them....is it possible to make my own procedures, and add them to turing somehow?
AsianSensation




PostPosted: Thu Dec 11, 2003 11:16 pm   Post subject: (No subject)

yes, use

code:
include


write a bunch of procedures, save it as some file, and then at the beginning of your new program, do this

code:
include "header.t"


that's the easiest way.

Other ways would be including changing Turing's system files and whatnot, and I think that's called software piracy Wink
DanShadow




PostPosted: Fri Dec 12, 2003 4:16 pm   Post subject: (No subject)

Ohhh...he wants to include procedures from file...make more specific questions, heh. Well yeah, use "include" to include procedures from disk.
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  [ 6 Posts ]
Jump to:   


Style:  
Search: