程序设计语言VB习题集含答案

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 页

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4