Private Sub CMD_CALCULATE_Click Dim matrix As Integer Dim vector As In

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Private Sub CMD_CALCULATE_Click()
Dim matrix() As Integer
Dim vector() As Integer
Dim rows_num As Integer
Dim columns_num As Integer
Dim vec_size As Integer
rows_num = TXT_ROWS_NUM.Text
columns_num = TXT_COLUMNS_NUM.Text
vec_size = TXT_VEC_SIZE.Text
ReDim matrix(columns_num - 1, rows_num - 1)
ReDim vector(vec_size - 1)
TXT_RESULT = ""
FillVector vector
ShowVector vector
Dim vector_index As Integer
vector_index = 0
For row = 0 To rows_num - 1
For col = 0 To columns_num - 1
matrix(col, row) = vector(vector_index)
vector_index = vector_index + 1
If vector_index > UBound(vector) Then vector_index = 0
TXT_RESULT.Text = TXT_RESULT & matrix(col, row) & " "
Next
TXT_RESULT.Text = TXT_RESULT & vbCrLf
Next
End Sub
Private Sub FillVector(ByRef vec() As Integer)
Dim result As Integer
result = 1
For i = 0 To UBound(vec)
vec(i) = Rnd() * 10 ' случайные числа от 0 до 10
' vec(i) = InputBox("Задайте значение элементу вектора") ' задать элменты вектора вручную
Next
fuct = result
End Sub
Private Sub ShowVector(ByRef vec() As Integer)
TXT_RESULT = "vector - "
For i = 0 To UBound(vec)
TXT_RESULT = TXT_RESULT & vec(i) & " "
Next
TXT_RESULT = TXT_RESULT + vbCrLf
End Sub