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

Username:   Password: 
 RegisterRegister   
 procedure with an array
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Ashi_Mashi3




PostPosted: Sat Feb 05, 2005 12:02 pm   Post subject: procedure with an array

Hi,
thank you for your excellent website...i have a problem....i want to make an array inside a procedure..i guess it should be like this:

procedure test (my_array : 1 .. 15 of string)
put my_array (1)
end test

now...how should i call the procedure? thank you
Sponsor
Sponsor
Sponsor
sponsor
Ashi_Mashi3




PostPosted: Sat Feb 05, 2005 12:12 pm   Post subject: Another Question!

by the way..i want to control a 7:5 dotmatrix display...so, i need a different parallleput for everyone of the LEDs...what's the best way to do this? ...
i did it like this....but, it would be so long and so boring! so, i thought about maybe using an array in a procedure and call it whenever i want....to reduce the lines...but, i dont think that's a good idea either...anyway, here's my code:
code:


% 1 2 3 4
% 5 6 7 8
% 9 A B C
% D E F G

var Delay : int := 1
var counter : int := 1

procedure Task
    delay (Delay)
    counter += 1
end Task

procedure N1
    parallelput (30)
    Task
end N1

procedure N2
    parallelput (29)
    Task
end N2
....
..
.

procedure AllLight
    loop
        exit when counter > 500
        N1
        N6
        NB
        NG
        ND
        NA
        N7
        N4
        N2
        N3
        N5
        N8
        N9
        NC
        NE
        NF
    end loop
    counter := 0
end AllLight
AllLight



thanks agian!
person




PostPosted: Sat Feb 05, 2005 2:50 pm   Post subject: (No subject)

procedure a
var str : array 1..15 of string
for x:1..15
str (x)
end for
end a
Bacchus




PostPosted: Sat Feb 05, 2005 3:09 pm   Post subject: (No subject)

no their talking about a way to put an array into a procedure as a parameter,
if proc test(x:array 1..15 of string) works then when you try calling it try

code:
proc test(x:array 1..15 of string)
put x(1)
end test

var myarray :array 1..15 of string
for i:1..15
myarray(i):="array #"+intstr(i)
end for

test(myarray)
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  [ 4 Posts ]
Jump to:   


Style:  
Search: