程序设计语言VB习题集含答案 下载本文

内容发布更新时间 : 2024/11/14 15:31:07星期一 下面是文章的全部内容请认真阅读。

102. Dim a, b, c As String

Private Sub Command1_Click()

a = InputBox(\请输入第一个字符串\b = InputBox(\请输入第二个字符串\End Sub

Private Sub Command2_Click() c = a + b

MsgBox \连接后的字符串为:\。长度为:\End Sub

103. Private Sub Command4_Click()

a = Val(Text1.Text) b = Val(Text2.Text) c = Val(Text3.Text) If a = 0 Then x = -c / b Print x Else

t = b * b - 4 * a * c If t < 0 Then Print \无解\ Else

X1 = (-b + Sqr(t)) / 2 / a X2 = (-b - Sqr(t)) / 2 / a Print X1, X2 End If End If End Sub

104. Private Sub Command1_Click()

m = Val(InputBox(\第一个数:\第二个数:\If n > m Then t = m: m = n: n = t End If r = m - n

Do While r > 0 If n < r Then t = n: n = r: r = t End If

m = n: n = r: r = m - n Loop

第 21 页 共 22 页

Print n End Sub

四、简答题 (略)……

第 22 页 共 22 页