Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Strict On
- Public Class Form1
- Function vvod(ByVal t As TextBox) As String
- Return (t.Text)
- End Function
- Sub vivvod_box(ByVal x As String, ByVal t As TextBox)
- t.Text = x
- End Sub
- Sub vvod_mas(ByRef x() As Integer)
- Dim i As Integer
- Dim r, y As String
- For i = 0 To UBound(x) - 1
- r = Str(i)
- y = (InputBox("элемент массива X(" + r + ")=", "Ввод значений элементов массива X()"))
- x(i) = CInt(y)
- Next
- End Sub
- Sub vivod_mas(ByVal x() As Integer, ByRef l As ListBox)
- For i = 0 To UBound(x) - 1
- l.Items.Add(x(i))
- Next
- End Sub
- Sub my_sub(ByVal x() As Integer, ByRef x1() As Integer, ByRef k As Integer)
- Dim i As Integer
- Dim j As Integer = 0
- For i = 0 To UBound(x) - 1
- If x(i) Mod 3 = 0 Then
- x1(j) = x(i)
- k = k * x1(j)
- j = j + 1
- MsgBox(k)
- End If
- Next
- ReDim Preserve x1(j)
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- Dim n As Integer
- Dim k As Integer = 1
- n = CInt(vvod(TextBox1))
- Dim x(n), x1(n) As Integer
- vvod_mas(x)
- vivod_mas(x, ListBox1)
- my_sub(x, x1, k)
- vivod_mas(x1, ListBox2)
- vivvod_box(CStr(k), TextBox2)
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement