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

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




PostPosted: Mon Dec 13, 2004 2:08 pm   Post subject: Randomizing Strings

Hay guys! This is a really dumb question but I need your help with randomizing string's and to put whatever it is on screen. Lemme explain more Confused ..lol.. I have a variable called 'face' and I want it to store certain images in string format (or WHATEVER format would be best..) The images are what you would type in on MSN Messenger.. you know.. A "Very Happy" for a big smilie, a "Razz" for a smilie but with his tongue sticking out, a ":S" for the confused guy.. basically I wantthe program to randome like 100's of these and draw them. Eventually once I get that they're going to be drawn to a file. but for now all I need is for it to look like this:

code:
:P :D :S :P :P :P :D :S


Here is what I have for starting- I know it isnt much but already Im getting angry!!..lol.. Delta and I did this once long ago but I forgot everything..
~Flashkicks
code:
var face : array 1 .. 5 of string
for i : 1 .. 5
    randint (face (i), ":P", ":D")
    put face (i), " " ..
end for


PS: This coding I have doesnt even werk yet:([/code]
Sponsor
Sponsor
Sponsor
sponsor
beard0




PostPosted: Mon Dec 13, 2004 2:28 pm   Post subject: (No subject)

Here you go:
code:
const faceArray : array 1 .. 3 of string := init (":P", ":S", ":D")
var faces : string := ""
for i : 1 .. 80
    if faces not= "" then
        faces += " "
    end if
    faces += faceArray (Rand.Int (1, 3))
end for
put faces
Flashkicks




PostPosted: Tue Dec 14, 2004 12:01 pm   Post subject: (No subject)

Wow, thank you so much beard0- it werks Swell!!
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  [ 3 Posts ]
Jump to:   


Style:  
Search: