Public Class Form1 Sub vivod_array ByVal As Double ByVal As TextBox Di

 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
Public Class Form1
Sub vivod_array(ByVal x() As Double, ByVal t As TextBox)
Dim i As Integer
For i = 0 To UBound(x)
t.Text = t.Text + Format(x(i), "00.00") + Space(1)
Next
End Sub
Sub vivod(ByVal d As Double, ByVal t As TextBox)
t.Text = CStr(d)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a(19) As Double
Dim i As Integer
Dim first, second As Integer
first = -1
second = -1
Randomize()
For i = 0 To UBound(a)
a(i) = -20 * Rnd() + 11
If (a(i) < 0) Then
If first = -1 Then
first = i
Else
If (first > -1) And (second = -1) Then
second = i
End If
End If
End If
Next
Dim z() As Double
Dim n As Integer
Dim summ As Double
ReDim z(second - first - 2)
For i = first + 1 To second - 1
z(n) = a(i)
n = n + 1
summ = summ + a(i)
Next
vivod_array(a, TextBox1)
vivod_array(z, TextBox2)
vivod(summ, TextBox3)
End Sub
End Class