profile
Опубликовано 5 лет назад по предмету Информатика от samuray19782107

Помогите определить виды матриц из данного примера: (2*A*E)+T Задача для VBa, знаю только, что E-треугольная.

Sub sup()
Dim A() As Integer
Dim B() As Integer
Dim C() As Integer
Dim D() As Integer
Dim E() As Integer
Dim T() As Integer
Dim N As Integer
Dim i As Integer
Dim j As Integer
Dim k As Integer

N = InputBox("Введите количество столбцов")
ReDim A(N, N)
ReDim B(N, N)
ReDim C(N, N)
ReDim D(N, N)
ReDim E(N, N)
ReDim T(N, N)
Randomize
Range("A1").Value = "(2*A*T)+E"
Range("A2").Value = "Матрица A"
For i = 1 To N
For j = 1 To N
If i <> j Then
A(i, j) = 1
End If

Next j
Next i
For i = 1 To N
For j = 1 To N
Cells(2 + 1, j).Value = A(i, j)

Next j
Next i
Cells(3 + N, 1).Value = "Матрица T"
For i = 1 To N
For j = 1 To N
If i >= j Then
T(i, j) = 0
Else
T(i, j) = Rnd * 10
End If

Next j
Next i
For i = 1 To N
For j = 1 To N
Cells(3 + N + i, j).Value = T(i, j)

Next j
Next i
Cells(4 + N * 2, 1).Value = "Матрица E"
For i = 1 To N
For j = 1 To N
E(i, j) = Rnd * 10
If i <> j Then E(j, i) = C(i, j)

Next j
Next i
For i = 1 To N
For j = 1 To N
Cells(4 + N * 2 + i, j).Value = E(i, j)

Next j
Next i
Cells(5 + N * 3, 1).Value = "C=A*T"
For i = 1 To N
For j = 1 To N
E(i, j) = 0
For k = 1 To N
E(i, j) = E(i, j) + A(i, k) * T(k, j)

Next k
Next j
Next i
For i = 1 To N
For j = 1 To N
Cells(5 + N * 3 + i, j).Value = C(i, j)

Next j
Next i
Cells(6 + N * 4, 1).Value = "B=C*2"
For i = 1 To N
For j = 1 To N
B(i, j) = C(i, j) * 2

Next j
Next i
For i = 1 To N
For j = 1 To N
Cells(6 + N * 4 + i, j).Value = T(i, j)

Next j
Next i
Cells(7 + N * 5, 1).Value = "D=B+C"
For i = 1 To N
For j = 1 To N
D(i, j) = B(i, j) + C(i, j)

Next j
Next i
For i = 1 To N
For j = 1 To N
Cells(7 + N * 5 + i, j).Value = D(i, j)
Next j
Next i

End Sub

  1. Ответ
    Ответ дан Аккаунт удален
    В первом вложении правильный код, во втором - пример картинки.
Самые новые вопросы