有下列函数过程:Function fun1(ByVal x As Integer,ByVal y As Integer)As IntegerDo While y<>0reminder=x Mod yx=yy=reminderLoopfun1=xEnd Function 在下列按钮单击事件中调用该函数,则该程序的运行结果是( )。Private Sub Command1_Click()Dim a As IntegerDim b As Integera=100b=25x=fun1(a,B)Print xEnd SubA.0B.25C.50D.100
有下列函数过程:
Function fun1(ByVal x As Integer,ByVal y As Integer)As Integer
Do While y<>0
reminder=x Mod y
x=y
y=reminder
Loop
fun1=x
End Function 在下列按钮单击事件中调用该函数,则该程序的运行结果是( )。
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
a=100
b=25
x=fun1(a,B)Print x
End Sub
A.0
B.25
C.50
D.100
相关考题:
program exam(output); var x,y,x:integer; proedure silly(x:integer;vary:integer); begin x:=5;y:=6;z:=3; writeln(x,y,z) end; begin x:=1;y:=2;z:=3; silly(x,y); writeln(x,y,z) end. 以上程序运行结果为(). A567 563B567 567C567 167D567 163
阅读以下应用说明及Visual Basic程序代码,将应填入(n)处的字句写在对应栏内。【说明8.1】以下程序的功能是:生成20个200~300之间的随机整数,输出其中能被5整除的数并求出它们的和。【程序代码8.1】Private Sub Command1_Click()For i=1 To 20x=Int((1)*200+100)If (2)=0 ThenPrint xS=S+ (3)End IfNext iPrint"Sum=";SEnd Sub【说明8.2】程序8.2运行后,单击窗体,则在窗体上显示的内容是:a=(4)和b=(5)。【程序代码8.2】Private Sub Form_Click()Dim a As Integer,b As Integera=20:b=50p1 a,bp2 a,bp3 a,bPrint"a=";a,"b=";bEnd SubSub p1(x As Integer, ByValy As Integer)x=x+l0y=y+20End SubSub p2(ByVal×As Integer, y As Integer)x=x+l0y=y+20End SubSub p3(ByVal×As Integer, ByVal y As Integer)x=x+10y=y+20End Sub
阅读下列程序说明和c代码,将应填入(n)处的字句写在对应栏内。[说明]下面的程序利用递归算法计算x和y的最大公约数。[函数2.1]main ( ){ int x,y,k,t;scanf(" % d% d" , x, y);if(x>y) { t=x;x=y; y=t;}(1);while(k! =0){y=x;(2);k=y%x;}prinff( "% d" ,x); }[函数2.2说明]函数fun(char *str,char *substr的功能是计算子串sugbstr在串str中出现的次数。[函数2.2]fun(ehar * str, char * substr){ int x,y,z;(3);for(x=0;str[ x] ! = '\O';x + + )for(y=x,z=0;sabstr[z] = =str[y];(4),y+ +)if((5)= ='\0') {num + +;break;}return(num);}
如果Add函数的调用代码为:func main() {var a Integer = 1var b Integer = 2var i interface{} = asum := i.(Integer).Add(b)fmt.Println(sum)}则Add函数定义正确的是() A.type Integer intfunc (a Integer) Add(b Integer) Integer { return a + b}B.type Integer intfunc (a Integer) Add(b *Integer) Integer { return a + *b}C.type Integer intfunc (a *Integer) Add(b Integer) Integer { return *a + b}D.type Integer intfunc (a *Integer) Add(b *Integer) Integer { return *a + *b}
11、下面哪些定义是类型正确的?A.f :: (Integer, Integer) - Float f (x,y) = x / yB.f :: (Integer, Integer) - Float f (x,y) = (fromInteger x) / (fromInteger y)C.f :: (Integer, Integer) - Float f (x,y) = 3*x + yD.f :: (Integer, Integer) - Integer f (x, y) = 3*x + y