三、 写出下列程序的运行结果:(30分)
1 Private Sub Command1_click( )
Dim a As Integer,b As Integer
A=10:b=20
tryout a,b
print “a=”;a,”b=”;b
End Sub
Sub tryout(x As Integer, ByVal y As Integer)
x=x+100
y=y*6
print “x=”;x,”y=”;y
End Sub
运行结果:
2 Sub Swap1(ByVal x%, ByVal y%)
t% = x: x = y: y = t
End Sub
Sub Swap2(x%, y%)
t% = x: x = y: y = t
End Sub
Private Sub Command1_Click()
a% = 10: b% = 20: Swap1 a, b '传值
Print "A1="; a, "B1="; b
a = 10: b = 20: Swap2 a, b '传址
Print "A2="; a, "B2="; b
End Sub
运行结果:
3 dim a(10,10)
for I=2 to 4
for j=4 to 5
a(I,j)=I*j
next j
next I
print a(2,5)+a(3,4)+a(4,5)
运行结果:
四、编程题(20分)
1 编一个求n!的子过程,然后调用它计算:7!+11!-10!
2 设计一个程序,在窗体中的文本框中显示时间。其运行界面如图:
x=110 y=120
a=110 b=20
A1=10 B1=20
A2=20 B2=10
42
Private Function jc(ByVal n As Long) As Long时间是 22:55:54
追答text1=right(cstr(t),8)