Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module Module1
- Sub Main()
- Dim a() As Single, b() As Single
- Dim n As Integer
- n = InputBox("Введите n")
- ReDim a(n), b(n)
- InputVector(a, "a")
- InputVector(b, "b")
- MsgBox(CheckVector(a, 5))
- MsgBox(CheckVector(b, 6))
- End Sub
- Private Sub InputVector(ByRef x() As Single, Optional ByVal ArrayName As String = "элемент")
- Dim i As Integer
- For i = 1 To x.GetUpperBound(0)
- x(i) = InputBox(ArrayName & "(" & i & ") = ?")
- Next
- End Sub
- Function CheckVector(ByRef x() As Single, ByVal a As Integer) As Integer
- Dim i As Integer, result As Integer
- result = 0
- For i = 0 To a
- If (x(i) > 0) Then result = result + 1
- Next i
- Return result
- End Function
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement