题目内容:
阅读以下应用说明及Visual Basic程序代码,将应填入(n)处的字句写在对应栏内。【说明8.1】
以下程序的功能是:生成20个200~300之间的随机整数,输出其中能被5整除的数并求出它们的和。
【程序代码8.1】
Private Sub Command1_Click()
For i=1 To 20
x=Int((1)*200+100)
If (2)=0 Then
Print x
S=S+ (3)
End If
Next i
Print"Sum=";S
End Sub
【说明8.2】
程序8.2运行后,单击窗体,则在窗体上显示的内容是:a=(4)和b=(5)。
【程序代码8.2】
Private Sub Form_Click()
Dim a As Integer,b As Integer
a=20:b=50
p1 a,b
p2 a,b
p3 a,b
Print"a=";a,"b=";b
End Sub
Sub p1(x As Integer, ByValy As Integer)
x=x+l0
y=y+20
End Sub
Sub p2(ByVal×As Integer, y As Integer)
x=x+l0
y=y+20
End Sub
Sub p3(ByVal×As Integer, ByVal y As Integer)
x=x+10
y=y+20
End Sub
参考答案: