Private Sub Command1_Click()
Dim t
Randomize
Do
t = Split(Int(100 + Rnd * 200) & " " & Int(100 + Rnd * 200) & " " & Int(100 + Rnd * 200))
Me.Caption = Join(t, ",")
Loop Until area(Val(t(0)), Val(t(1)), Val(t(2))) = True
End Sub
Private Sub Form_Load()
Me.Scale (-100, 400)-(400, -100)
End Sub
Function area(a, b, c) As Boolean
If (a + b > c) And (b + c > a) And (c + a > b) Then
area = True
Text1.Text = (((a + b + c) * (a + b - c) * (b + c - a) * (c + a - b)) ^ 1 / 2) / 4
Dim cosb As Single
cosb = (a ^ 2 + c ^ 2 - b ^ 2) / (2 * a * c)
Me.Cls
Me.Line (0, 0)-(b, 0), vbRed
Me.Line (0, 0)-(a * cosb, a * Sqr(1 - cosb ^ 2)), vbRed
Me.Line (b, 0)-(a * cosb, a * Sqr(1 - cosb ^ 2)), vbRed
End If
End Function
Private Sub Command1_Click()
Dim t
Randomize
Do
t = Split(Int(100 + Rnd * 200) & " " & Int(100 + Rnd * 200) & " " & Int(100 + Rnd * 200))
Me.Caption = Join(t, ",")
Loop Until area(Val(t(0)), Val(t(1)), Val(t(2))) = True
End Sub
Private Sub Form_Load()
Me.Scale (-100, 400)-(400, -100)
End Sub
Function area(a, b, c) As Boolean
If (a + b > c) And (b + c > a) And (c + a > b) Then
area = True
Text1.Text = (((a + b + c) * (a + b - c) * (b + c - a) * (c + a - b)) ^ 1 / 2) / 4
Dim cosb As Single
cosb = (a ^ 2 + c ^ 2 - b ^ 2) / (2 * a * c)
Me.Cls
Me.Line (0, 0)-(b, 0), vbRed
Me.Line (0, 0)-(a * cosb, a * Sqr(1 - cosb ^ 2)), vbRed
Me.Line (b, 0)-(a * cosb, a * Sqr(1 - cosb ^ 2)), vbRed
End If
End Function