8.Function isQO(ByVal x As Integer) As String If x Mod 2 =0 Then isQO=”偶数” Else
isQO=”奇数” End If End Function
9.Function F1(ByVal x As Integer) As Boolean If x Mod 17 =0 and x Mod 37 =0Then F1=True Else F1=False End If End Function
Private Sub Form_Click() For i = 1000 To 2000 If F1(i) Then Print i End if Next i
End Sub
10.Sub F1(a() As Integer, ByVal L1 As Integer, ByVal L2
As
Integer)
Dim L%, U%, x%, i%
L = LBound(a): U = UBound(a) If L1 > U Or L2 > U Then Print \位置输入错误!\Exit Sub End If
If L1 > L2 Then x = a(L1)
For i = L1 To L2 + 1 Step -1 a(i) = a(i - 1) Next i a(L2) = x
ElseIf L2 > L1 Then x = a(L1)
For i = L1 To L2 - 1 a(i) = a(i + 1)
Next i a(L2) = x End If End Sub
第九章 习题参考答案 一、选择题: 1—3: ADD 二、填空题
1.下拉式 弹出式 2.PopupMenu 3.Visible Enabled 4.- 三、编程题(略)
第十章 习题参考答案 一、选择题: 1—3: DBD 二、填空题
1.Load 2.窗体模块 标准模块 类模块 3.DoEvents 三、编程题
1.(略)
2.Function F(ByVal x&,ByVal Y&) As Integer Dim t&,r&
If x
End Function
Private Sub Command1_Click()
Text3 = Val(Text1) / F(Val(Text1), Val(Text2)) Text4 = Val(Text2) / F(Val(Text1), Val(Text2)) End Sub
第十一章 习题参考答案 一、选择题: 1—3: DDA 二、填空题
6 2.AB A 三、编程题
1.Private Sub Form_MouseMove(Button As Integer, Shift
As Integer, x
Integer, x As
Integer, x As
As Single, Y As Single) Text1 = x: Text2 = Y End Sub 2.
Dim startX, StartY As Integer ‘在通用中申明
Private Sub Form_MouseDown(Button As Integer, Shift As
Single, Y As Single) If Button = 2 Then startX = x: StartY = Y End If End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As
Single, Y As Single) If Button = 1 Then