Public Structure treugolniki
Dim a, b, c As Single
Dim p As Single
Public Sub vvod()
Dim a, b, c As Single
a = Val(InputBox("VVedite 1 storonu treugolnika"))
b = Val(InputBox("VVedite 2 storonu treugolnika"))
c = Val(InputBox("VVedite 3 storonu treugolnika"))
End Sub
Public Function perimetr() As Single
Dim p As Single
p = a + b + c
perimetr = p
End Function
Public Function stroka_dlya_vuvoda() As String
Dim s As String
s = "1,2,3 storonu treugolnika sootvetstvenno: " + Str(a) + " " + Str(b) + " " + Str(c) + ".Perimetr: " + Str(perimetr)
stroka_dlya_vuvoda = s
End Function
End Structure
Public Sub vvod_massiva_treugolnikov(ByRef X() As treugolniki, ByVal n As Integer)
n = Val(InputBox("Vvedite kolichestvo treugolnikov"))
ReDim X(n - 1)
For i = 0 To n - 1
X(i).vvod()
X(i).perimetr()
Next
End Sub
Public Sub vuvod_massiva(ByRef list As ListBox, ByVal x() As treugolniki, ByVal n As Integer)
Dim i As Integer
ListBox1.Items.Clear()
For i = 0 To n - 1
list.Items.Add(x(i).stroka_dlya_vuvoda)
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x() As treugolniki
Dim n As Integer
vvod_massiva_treugolnikov(x, n)
vuvod_massiva(ListBox1, x, n)
End Sub
End Class