VB.net:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim a, b, c, p As Integer
a = Integer.Parse(TextBox1.Text)
b = Integer.Parse(TextBox2.Text)
c = Integer.Parse(TextBox3.Text)
If a + b > c And a + c > b And b + c > a And Math.Abs(a - b) < c And Math.Abs(a - c) < b And Math.Abs(b - c) < a Then
p = (a + b + c) / 2
Label1.Text = "S = " & Math.Sqrt(p * (p - a) * (p - b) * (p - c)) & vbCrLf & "C = " & (2 * p)
Else
MsgBox("不能构成三角形", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "错误")
End If
End Sub
End Class
追问请详细点吧 基本是不懂得vb
追答这是VB.net的代码,如果你用的是VB6是不行的
追问我用的就是vb6
追答抱歉 不记得怎么用了 两三年前用的vb6
追问还是很很
谢谢你