假定有以下两个过程: Sub S1(ByVal x As Integer, ByVal y As Integer) Dim t As Integer t=K x=y y=t End Sub Sub S2(x As Integer, y As Integer) Dim t As Integer t=K x=y y=t End Sub 则以下说法中正确的是 ( ) A.用过程S1可以实现交换两个变量值的操作,S2不能实现 B.用过程S2可以实现交换两个变量值的操作,S1不能实现 C.用过程S1和S2都可以实现交换两个变量值的操作 D.用过程S1和S2都不能实现交换两个变量值的操作
举一反三
- Sub s1(ByVal x As Integer, ByVal y As Integer) Dim t As Integer t = x: x = y: y = t End Sub Sub s2(x As Integer, y As Integer) Dim t As Integer t = x: x = y: y = t End Sub 则以下说法中正确的是( )。
- 假定有以下两个过程: A: 用过程S1可以实现交换两个变量的值的操作,S2不能实现 B: 用过程S2可以实现交换两个变量的值的操作,S1不能实现 C: 用过程S1和s2都可以实现交换两个变量的值的操作 D: 用过程S1和s2都不能实现交换两个变量的值的操作
- 本程序的功能为单击窗体,分别调用Swap1和Swap2子过程,使Form1的输出结果为 A1=10 B1=20 A2=20 B2=10 请将程序补充完整。 Public Sub Swap1(【1】) Dim t As Integer t = x: x = y: y = t End Sub Public Sub Swap2(【2】) Dim t As Integer t = x: x = y: y = t End Sub Private Sub Form_Click() Dim a As Integer, b As Integer a = 10: b = 20 【3】 Form1.Print "A1="; a, "B1="; b call swap2(a,b) Form1.Print "A2="; a, "B2="; b End Sub
- 下面可以正确定义两个整型变量和—个字符串变量的语句是()。 A: Dim n,m As Integer,s As String B: Dim a%,b$,c As String C: Dim a As Integer,b,c As String D: Dim x%,y As Integer,z As String
- 1.以下程序的功能是:生成 20 个 200 到 300 之间的随机整数,输出其中能被 5 整除的数并求出它们的和。 Private Sub Command1_C1ick() Dim s As Integer Dim x As Integer, i As Integer s = 【1】 Randomize For i = 1 To 20 x = Int(【2】 * 101 + 200) If x 【3】 5 = 0 Then Print x s = s + x End If Next i Print "Sum ="; s End Sub