level 1
Private Sub Command1_Click()
Dim x As Single, y As Single, z As Single, c, area As Single
Dim d As Integer
x = Val(Text1.Text)
y = Val(Text2.Text)
z = Val(Text3.Text)
If z > x And z > y Then
d = x And x = y And y = z And z = d
End If
If (x ^ 2 + y ^ 2 = z ^ 2) And (z ^ 2 - y ^ 2 = x ^ 2) And (z ^ 2 - x ^ 2 = y ^ 2) Then
c = (x + y + z) / 2
area = Sqr(c * (c - x) * (c - y) * (c - z))
MsgBox "直角三角形的面积是:" & Format(area, "###.00"), , "直角三角形面积"
Else
MsgBox "不能构成直角三角形", , "警告"
End IfEnd SubPrivate Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.SetFocus
End SubPrivate Sub Command3_Click()
End
End Sub
2020年12月05日 10点12分
