我用vb写了一个计算长方形~正方形或三角形面积的程序~

问题描述:

我用vb写了一个计算长方形~正方形或三角形面积的程序~
代码如下~怎样修改啊~
Private Sub Command1_Click()
Dim a As String
Dim h,l,s As Single
a = InputBox("请输入形状(只限于长方形~正方形或三角形)","请输入")
If (a = "长方形" Or "正方形") Then
h = InputBox("请输入宽","请输入")
l = InputBox("请输入长","请输入")
s = h * l
Print a; "的面积为"; s
Else
h = InputBox("请输入的高","请输入")
l = InputBox("请输入的底","请输入")
s = h * l / 2
Print a; "的面积为"; s
End If
MsgBox "计算完毕",,"提示"
End Sub

判断写错,改完的:Private Sub Command1_Click()Dim a As StringDim h,l,s As Singlea = InputBox("请输入形状(只限于长方形~正方形或三角形)","请输入")If (a = "长方形" Or a = "正方形") Thenh = InputBox("请...谢谢呀~~顺便问一下~h = InputBox("请输入宽", "请输入")在这段代码里~我想显示为这样“请输入长方形的宽”即请输入a形的宽~~应该怎么改呀~~?Private Sub Command1_Click()Dim a As StringDim h, l, s As Singlea = InputBox("请输入形状(只限于长方形~正方形或三角形)", "请输入")If (a = "长方形" Or a = "正方形") Thenh = InputBox("请输入" & a & "的宽", "请输入")l = InputBox("请输入" & a & "的长", "请输入")s = h * lPrint a; "的面积为"; sElseh = InputBox("请输入" & a & "的高", "请输入")l = InputBox("请输入" & a & "的底", "请输入")s = h * l / 2Print a; "的面积为"; sEnd IfMsgBox "计算完毕", , "提示"End Sub