Лабораторная работа: Расположение элементов в матрице

Private Sub cmdRun_Click()

txtN.Enabled = False

Dim pi As Integer, pj As Integer

Dim i As Integer, j As Integer

Dim t As Integer, n As Integer

Dim k As Integer, p As Integer

n = Val(txtN.Text)

txtOriginal.Text = Empty

ReDim a(n, n) As Integer

For i = 1 To n

For j = 1 To n

a(i, j) = Int(Rnd * 90) + 10

txtOriginal.Text = txtOriginal.Text & Str(a(i, j)) & " "

Next j

txtOriginal.Text = txtOriginal.Text & vbCrLf

Next i

ReDim x(n ^ 2) As Integer

k = 0

p = n / 2 * 11

pi = Int(p / 10)

pj = p - pi * 10

k = k + 1

x(k) = a(pi, pj)

For i = 1 To n - 1

For t = 1 To 10 Step 9

For j = 1 To i

p = p + (-1) ^ (i + 1) * t

pi = Int(p / 10)

pj = p - pi * 10

К-во Просмотров: 347
Бесплатно скачать Лабораторная работа: Расположение элементов в матрице