vb三角形面积计算代码_vb三角形面积代码 每日观察

观点 | 2023-04-24 07:45:27
时间:2023-04-24 07:45:27   /   来源: 互联网      /   点击数:()


(资料图)

1、代码如下。

2、 ============== Private Sub Form_Load() Do Dim a As Single, b As Single, c As Single, p As Single, s As Single a = Val(InputBox("请输入三角形第1条边长")) If a = -1 Then Exit Do b = Val(InputBox("请输入三角形第2条边长")) If b = -1 Then Exit Do c = Val(InputBox("请输入三角形第3条边长")) If c = -1 Then Exit Do p = (a + b + c) / 2 If a >= p Or b >= p Or c >= p Then MsgBox "不能构成三角形" Else s = Sqr(p * (p - a) * (p - b) * (p - c)) MsgBox "面积为" & s End If Loop End End Sub。

本文到此分享完毕,希望对大家有所帮助。

标签:

最近更新