已知三角形三个边的长度值,求三个角的大小

没什么技术含量,一个余弦定理搞定:

Function angle(ByVal a As Double, ByVal b As Double, ByVal c As Double)
angle = (b * b + c * c - a * a) / (2 * b * c)
angle = Atn(-angle / Sqr(1 - angle * angle)) + 2 * Atn(1)
angle = Format(angle * 45 / Atn(1), "0.00") & "°"
End Function
Sub getangles(ByVal a As Double, ByVal b As Double, ByVal c As Double)
Dim x(6) As String
x(0) = "IF a=" & a
x(1) = " b=" & b
x(2) = " c=" & c
x(3) = "Then"
x(4) = "∠ABC=" & angle(b, c, a)
x(5) = "∠BAC=" & angle(a, b, c)
x(6) = "∠ACB=" & angle(c, a, b)
MsgBox Join(x, vbCrLf), vbInformation, "Result"
End Sub
Private Sub Command1_Click()
getangles 1, 2, 1.732
End Sub

你可能感兴趣的:(C++,c,C#)