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, c() As Single
- Dim n As Integer
- n = InputBox("Введите n")
- ReDim a(n)
- ReDim b(n)
- ReDim c(n)
- InputVector(a, "a")
- InputVector(b, "b")
- InputVector(c, "c")
- MsgBox("Одинаковых между A, B: " + CheckVectors(a, b).ToString)
- MsgBox("Одинаковых между B, C: " + CheckVectors(b, c).ToString)
- 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 CheckVectors(ByRef x() As Single, ByRef y() As Single) As Integer
- Dim i As Integer, result As Integer
- result = 0
- For i = 0 To x.GetUpperBound(0) - 1
- If (x(i) = y(i)) Then
- result = result + 1
- End If
- Next i
- Return result
- End Function
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement