标题:VB 球帮助 谢谢 谢谢 谢谢 谢谢 谢谢 谢谢 谢谢 谢谢 谢谢 谢谢 ...
取消只看楼主
ld269440877
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2014-10-26
结帖率:0
已结贴  问题点数:20 回复次数:0 
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
2014-10-26 18:04



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-437725-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.128514 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved