重币悬赏!急!vb编写程序题

来源:百度知道 编辑:UC知道 时间:2024/06/16 09:29:29
1 在窗体上单击按扭1,可通过输入对话框输入两个字符串;单击按钮2,将输入的两个字符串连接为一个字符串,并计算该字符串长度,然后在消息框中显示出来。

2有a,b,c三个数,在程序中通过文本框给a,b赋值;再调用能完成a,b比较大小的子过程,用c将大数回传。要求按值传送a,b.

3输入三角形的三条边a,b,c的值,根据其数值判断能否构成三角形。能,则判断三角形是否是直角三角形,是则计算三角形的面积。

1、添加两个按钮
Dim a As String
Dim b As String
Private Sub Command1_Click()
a = InputBox("请输入字符串1")
b = InputBox("请输入字符串2")
End Sub

Private Sub Command2_Click()
MsgBox "拼接后为" & a & b & " " & "长度为" & Len(a & b)
End Sub

2、两个文本框,一个按钮
Dim a As Double
Dim b As Double
Dim c As Double

Sub compare(ByVal a As Double, ByVal b As Double)
If a > b Then
c = a
Else
c = b
End If
End Sub

Private Sub Command1_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
compare a, b
MsgBox "较大数是" & c
End Sub

3、添加一个按钮
Dim a As Double
Dim b As Double
Dim c As Double

Sub max()
Dim p As Double
If b > a And b > c Then
p = a
a = b
b = p
End If
If c > a And c > b Then
p = a
a = c
c =