VB 球帮助 谢谢 谢谢 谢谢 谢谢 谢谢 谢谢 谢谢 谢谢 谢谢 谢谢 谢谢!
程序代码:
Private Sub Command1_Click() Dim a As Variant, b As Variant, c As Variant Dim max As Variant, mid As Variant, min As Variant a = Val(InputBox("输入 a 的值 :", "三角形的边长 a= :")): Text1.Text = a b = Val(InputBox("输入 b 的值 :", "三角形的边长 b= :")): Text2.Text = b c = Val(InputBox("输入 c 的值 :", "三角形的边长 c= :")): Text3.Text = c max = a If c >= max Then max = c: Text1.Text = "max : a=" & Str(max) If b >= max Then max = b: Text1.Text = "max : a=" & Str(max) If max >= b And max >= c Then Text1.Text = "max : a=" & Str(max) min = a If c <= min Then min = c: Text3.Text = "min : c=" & Str(min) If b <= min Then min = b: Text3.Text = "min : c=" & Str(min) If min <= b And min <= c Then Text3.Text = "min : c=" & Str(min) mid = a + b + c - max - min: Text2.Text = "mid : b=" & Str(mid) a = max: b = mid: c = min Label2.Caption = a: Label3.Caption = b: Label4.Caption = c If b + c〉a Then If b ^ 2 + c ^ 2 > a ^ 2 Then If a = b And b = c And c = a Then Label1.Caption = "等边三角形" Else If a = b Or b = c Or c = a Then Label1.Caption = "锐角等腰三角形" Else Label1.Caption = "普通锐角三角形" End If End If End If If b ^ 2 + c ^ 2 < a ^ 2 Then If a = b Or b = c Or a = c Then Label1.Caption = "钝角等腰 三角形" Else Label1.Caption = "普通钝角三角形" End If End If If Abs(a ^ 2 - b ^ 2 + c ^ 2) <= 2 Then If a = b Or b = c Or c = a Then Label1.Caption = "等腰直角三角形" Else Label1.Caption = "直角三角形" End If End If Else Label1.Caption = "不是三角形" End If End Sub