Приложение -pr 9.rar
Занятие 28. Практическая работа № 9.
Инструкция
Интерфейс проекта
Программный код
Public p1, a, b, c, d, k, s1, s2, p2, s As Single
Private Sub geron(ByVal x As Single, ByVal y As Single, ByVal z As Single, ByRef perimetr As Single, ByRef s As Single)
perimetr = (x + y + z) / 2
s = System.Math.Sqrt(perimetr * (perimetr - x) * (perimetr - y) * (perimetr - z))
End Sub
Private Sub ctorona(ByVal m1 As Integer, ByVal m2 As Integer, ByVal n1 As Integer, ByVal n2 As Integer, ByRef l As Single)
l = System.Math.Sqrt((m2 - m1) ^ 2 + (n2 - n1) ^ 2)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
a = Val(InputBox("a="))
b = Val(InputBox("b="))
c = Val(InputBox("c="))
d = Val(InputBox("d="))
k = System.Math.Sqrt(a ^ 2 + b ^ 2) : MessageBox.Show("k= " & k) 'diagonal
geron(a, b, k, p1, s1)
MessageBox.Show("p1= " & p1)
MessageBox.Show("s1= " & s1)
geron(c, d, k, p2, s2)
s = s1 + s2
MessageBox.Show("p2= " & p2)
MessageBox.Show("s2= " & s2)
MessageBox.Show("s= " & s)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim x1, x2, x3, x4, y1, y2, y3, y4 As Integer
Dim w As Single
x1 = Val(InputBox("x1="))
x2 = Val(InputBox("x2="))
x3 = Val(InputBox("x3="))
x4 = Val(InputBox("x4="))
y1 = Val(InputBox("y1="))
y2 = Val(InputBox("y2="))
y3 = Val(InputBox("y3="))
y4 = Val(InputBox("y4="))
ctorona(x1, x2, y1, y2, w) 'w-ctorona
a = w
MessageBox.Show("a= " & a)
ctorona(x2, x3, y2, y3, w) 'w-ctorona
b = w
MessageBox.Show("b= " & b)
ctorona(x3, x4, y3, y4, w) 'w-ctorona
c = w
MessageBox.Show("c= " & c)
ctorona(x4, x1, y4, y1, w) 'w-ctorona
d = w
MessageBox.Show("d= " & d)
k = System.Math.Sqrt(a ^ 2 + b ^ 2) : MessageBox.Show("k= " & k) 'diagonal
geron(a, b, k, p1, s1)
MessageBox.Show("p1= " & p1)
MessageBox.Show("s1= " & s1)
geron(c, d, k, p2, s2)
s = s1 + s2
MessageBox.Show("p2= " & p2)
MessageBox.Show("s2= " & s2)
MessageBox.Show("s= " & s)
End Sub
Занятие 28
|