Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. Module Module1
  2.  
  3. Sub Main()
  4. Dim a() As Single, b() As Single
  5. Dim n As Integer
  6. n = InputBox("Введите n")
  7. ReDim a(n), b(n)
  8. InputVector(a, "a")
  9. InputVector(b, "b")
  10. MsgBox(CheckVector(a, 5))
  11. MsgBox(CheckVector(b, 6))
  12. End Sub
  13. Private Sub InputVector(ByRef x() As Single, Optional ByVal ArrayName As String = "элемент")
  14. Dim i As Integer
  15. For i = 1 To x.GetUpperBound(0)
  16. x(i) = InputBox(ArrayName & "(" & i & ") = ?")
  17. Next
  18. End Sub
  19. Function CheckVector(ByRef x() As Single, ByVal a As Integer) As Integer
  20. Dim i As Integer, result As Integer
  21. result = 0
  22. For i = 0 To a
  23. If (x(i) > 0) Then result = result + 1
  24. Next i
  25. Return result
  26. End Function
  27. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement