Private Sub Command1_Click()
Dim a As Single, b As Single, c As Single, x As Single
a = imputbox("请输入a的值")
b = imputbox("请输入b的值")
c = imputbox("请输入c的值")
x = (a + b + c) / 2
If a+b>c:a+c>b:b+c>a Then
s = Sqr(x * (x - a) * (x - b) * (x - c))
Else
s = 0
End If
End Sub
If a+b>c:a+c>b:b+c>a Then有错吗?
參考答案:有错,你是想用:表示与关系吗?vb是用and的。
if a+b>c and a+c>b and b+c>a then