|
-
Jun 21st, 2004, 11:39 AM
#1
Thread Starter
New Member
I'm STUCK and stupid!!!!!!!!!!!
Ok, i recently got vb.net to take my first steps into programming because i find it enjoyable and i'd like to maybe learn some more complex languages eventually and make loads of money.
Anyway, i have brought Sams teach yourself vb .net in 21 days to teach myself and so far it seems great and i think i've understood everything but i'm stuck on day 2. the question at the end of the chapter is"Using one For Loop inside another (nesting two for loops), display all the elements of a 3x3 two dimensional array."
Unfortunately i'm stupid, i've understood everything so far but it expects you to use your own initiative to work this one out but i've tried real hard and here's what i've come up with:
Dim intinput(2, 2) As Integer
intinput(0, 0) = 5
intinput(0, 1) = 10
intinput(0, 2) = 20
intinput(1, 0) = 30
intinput(1, 1) = 40
intinput(1, 2) = 50
intinput(2, 0) = 60
intinput(2, 1) = 70
intinput(2, 2) = 80
so theres my two dimensional array with 3 columns and 3 rows, all assigned a value correctly i hope.
next it goes like this:
For index As Integer = (0) To UBound(intinput)
Console.WriteLine("Score is (" & intinput & ") = " & intinput(index))
Next
i've got this far now im completely confused, i used a similar thing to succesfully display all the results in a simple 1 dimensional array. I am using a console application for this as the book recommends this for starting out.
-
Jun 21st, 2004, 12:47 PM
#2
VB Code:
dim x as integer
dim y as integer
For x = 0 to intinput.GetUpperBound(0)
For y = 0 to intinput.GetUpperBound(1)
Console.Writeline(intinput(x,y))
Next
Next
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|