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

Username:   Password: 
 RegisterRegister   
 Local Variables That Give a Value to an Array and the Size
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TheXploder




PostPosted: Wed Jan 28, 2004 12:33 pm   Post subject: Local Variables That Give a Value to an Array and the Size

I'm trying to make a check for words, and with each same procedure check different words and enable bigger arrays:

code:

proc words (size : int, name1, name2 : string)
    var word : array 1 .. size of string := init (name1, name2)
    for i : 1 .. size
        if word (i) = "Xploder" then
            put "Name matches!"
        else
            put "Name doesn't match!"
        end if
    end for
end words

words (2, "Xploder", "TheXploder")
words (3, "Cool", "Uncool", "TheXploder")


It doesn't seem to work quite right... hope you get where I am going with this, could you please hlep me out...
Sponsor
Sponsor
Sponsor
sponsor
TheXploder




PostPosted: Wed Jan 28, 2004 12:49 pm   Post subject: (No subject)

ohh, fixed it:

code:

proc words (size : int, name1, name2 : string)
    var word : array 1 .. size of string
    word (1) := name1
    word (2) := name2
    for i : 1 .. size
        if word (i) = "Xploder" then
            put "Name matches!"
        else
            put "Name doesn't match!"
        end if
    end for
end words

words (2, "Xploder", "TheXploder")
Paul




PostPosted: Wed Jan 28, 2004 12:53 pm   Post subject: (No subject)

Yay! way to go self-help...
we64




PostPosted: Wed Jan 28, 2004 1:47 pm   Post subject: (No subject)

Very Happy Very Happy yeah good job
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: