Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. Module Module1
  2.  
  3. Sub Main()
  4. Dim a() As Single, b() As Single, c() As Single
  5. Dim n As Integer
  6. n = InputBox("Введите n")
  7. ReDim a(n)
  8. ReDim b(n)
  9. ReDim c(n)
  10. InputVector(a, "a")
  11. InputVector(b, "b")
  12. InputVector(c, "c")
  13. MsgBox("Одинаковых между A, B: " + CheckVectors(a, b).ToString)
  14. MsgBox("Одинаковых между B, C: " + CheckVectors(b, c).ToString)
  15. End Sub
  16. Private Sub InputVector(ByRef x() As Single, Optional ByVal ArrayName As String = "элемент")
  17. Dim i As Integer
  18. For i = 1 To x.GetUpperBound(0)
  19. x(i) = InputBox(ArrayName & "(" & i & ") = ?")
  20. Next
  21. End Sub
  22. Function CheckVectors(ByRef x() As Single, ByRef y() As Single) As Integer
  23. Dim i As Integer, result As Integer
  24. result = 0
  25. For i = 0 To x.GetUpperBound(0) - 1
  26. If (x(i) = y(i)) Then
  27. result = result + 1
  28. End If
  29. Next i
  30. Return result
  31. End Function
  32. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement