1

Topic: Spiral matrix VB 6

Hello experts. I ask you to help to write me a spiral matrix in Visual Basic 6.
I.e. that it turned out so
1 2 3 4 5
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9
The matrix should be deduced on PictureBox, tried to write itself but that that especially is impossible.

Dim i As Integer, j As Integer, di As Integer, dj As Integer, value As Integer
n = InputBox ("n =")
Picture1.Scale (0, 0) - (n + 1, n + 1)
Picture1.Cls
ReDim x (1 To n, 1 To n)
For i = 1 To n
For j = 1 To n
If (i> 1 And i <n + 2 And j> 1 And j <= n + 1) Then
i + di, j + dj, di, dj, value + 1
Else
If (value <= n * n) Then
If (di = 1 And dj = 0) Then i - 1, j - 1, 0,-1
If (di = 0 And dj = 1) Then i + 1, j - 1, 1, 0
If (di =-1 And dj = 0) Then i + 1, j + 1, 0, 1
If (di = 0 And dj =-1) Then i - 1, j + 1,-1, 0
?????

2

Re: Spiral matrix VB 6

At first write algorithm of filling of a matrix words (well or the circuit), and then to translate it in the code - a trick

3

Re: Spiral matrix VB 6

Rebellion, https://www.google.ru/search? q= a spiral site:www.cyberforum.ru/visual-basic/

4

Re: Spiral matrix VB 6

Thanks, understood