Computer Science Canada Array Help |
Author: | UaSMatrix [ Fri May 01, 2009 7:52 pm ] |
Post subject: | Array Help |
Hello, I'm new to the forum and somewhat new to VB, too. I was wondering if anyone could help me with an array issue. I'll try to explain it as best as I can. The program is somewhat pointless but its a program to get practice with. When you start up the file, it asks you to set a number between 1 and 26. Then, it picks a random number between 1 and 26 however many times you set. These are numbers for an array value. For instance, 1 = a, 2=b, 3=c, etc. As it does this, another array is getting these values put into it, starting at 1 and going up to as many times as you set. Anyway, my problem is that I need it to display all the letters in one message box when it finishes, and not in multiple message boxes. Also, I am doing this through notepad and not something like VB 6.0, so the code may be a different "style" I suppose. Here's what I've made so far: dim rndthing(26) dim Que dim Response(26) dim Helper dim upperlimit,lowerlimit dim V dim Somethin rndthing(1) = "a" rndthing(2) = "b" rndthing(3) = "c" rndthing(4) = "d" rndthing(5) = "e" rndthing(6) = "f" rndthing(7) = "g" rndthing(8) = "h" rndthing(9) = "i" rndthing(10) = "j" rndthing(11) = "k" rndthing(12) = "l" rndthing(13) = "m" rndthing(14) = "n" rndthing(15) = "o" rndthing(16) = "p" rndthing(17) = "q" rndthing(18) = "r" rndthing(19) = "s" rndthing(20) = "t" rndthing(21) = "u" rndthing(22) = "v" rndthing(23) = "w" rndthing(24) = "x" rndthing(25) = "y" rndthing(26) = "z" v = cint(0) somethin = cint(0) Que = inputbox("How many random letters?","Random Letters") if(not(isnumeric(que))) then msgbox("Invalid Operands!") wscript.quit end if if(que > 26) then msgbox("Too high.") wscript.quit end if if(que < 1) then msgbox("Too low.") wscript.quit end if que=cint(que) do until V = que upperlimit = 26 lowerlimit = 1 randomize helper =Int((upperlimit - lowerlimit + 1)*Rnd() + lowerlimit) V = V + 1 response(V) = rndthing(helper) loop for x=1 to que msgbox("Answer: " & response(x)) Next The main issue is in the bottom area where it starts with For x=1 to que, and anything below that too. |
Author: | UaSMatrix [ Mon May 04, 2009 2:06 pm ] |
Post subject: | RE:Array Help |
Never mind I figured it out... |