(29) 有如下事件过程:
Function UNC (ByVal x As Integer, ByVal y As Integer) As Integer
Do While y <> 0
sic=x / y
x=y
y=sic
Loop
UNC=x
End Function
以下是该函数的调用过程,该程序的运行结果是
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
a=12
b=2
x=UNC (a, b)
Print x
End Sub
A) 0
B) 6
C) 2
D) 80
【命题目的】考查考生对函数的定义和调用的运用。
【解题要点】本题考查函数调用和输出格式的语句。调用UNC的过程如下:
x=12,y=2时,sic=6,x=2,y=6;
x=2,y=6时,sic=0,x=6,y=0;
y=0,所以跳出循环,输出x=6并结束程序。
【考点链接】过程的定义和调用。