程序如下:Private Sub form_ Activate() Dim a As Integer for i=4 To 5 a=fun(i) Print a, Next iEnd SubPrivate Function fun(n)As Integer if n >0 then fun =n* fun(n-1) Else fun=1 End ifEnd Function 程序最后打印结果是______。A.4 5B.12 120C.24 120D.24 60

程序如下:Private Sub form_ Activate() Dim a As Integer for i=4 To 5 a=fun(i) Print a, Next iEnd SubPrivate Function fun(n)As Integer if n >0 then fun =n* fun(n-1) Else fun=1 End ifEnd Function 程序最后打印结果是______。

A.4 5

B.12 120

C.24 120

D.24 60


相关考题:

3有如下程序,输出结果为( )。 Private Sub Form_Activate() Dima a=Array(1,2,3,4,5) Fori=LBound(a)To UBound(A) a(i)=i*a(i) Nexti Printi,LBound(a),UBound(a),a(i) End SubA.4 0 4 25B.5 0 4 25C.不确定D.程序出错

有如下程序:includeusing namespace std;Class TestClass{private:int x,y;public:Te 有如下程序: #include<iostream> using namespace std; Class TestClass { private: int x,y; public: TestClass(int i,int j) { x=i; y=j; } void print() { cout<<“print1”<<endl; } void print()const { cout<<”prinA.printlB.print2C.printl print2D.程序编译时出错。

有如下程序: include using namespace std; class Sample { frien 有如下程序: #include <iostream> using namespace std; class Sample { friend long fun(Sample s); public: Sample(long a) {x=a;} private: long x; }; long fun(Sample s) { if(s.x < 2) return 1; return s.x * fun(Sample(s.x-1)); } int main() { int stun = 0; for (int i=0; i<6; i++) {sum += fun(Sample(i));} cout << sum; return 0; }运行时输出的结果是A.120B.16C.154D.34

有如下程序 include using namespace std;int i=1;class Fun {public:static int i;i 有如下程序 #include <iostream>using namespace std;int i=1;class Fun {public:static int i;int value(){ return i-1;}int value()const{ return i+1;}};int Fun:: i=2;int main() {int i=3;Fun fun1;const Fun fun2;______________________return ();}若程序的输出结果是:123A.cout<<fun1.value()<<Fun:: i<<fun2.value();B.cout<<Fun::i<<fun1.value()<<fun2.value();C.cout<<fun1. value()<<fun2.value()<<Fun:: i;D.cout<<fun2.value()<<Fun:: i<<fun 1.value();

有如下程序:includeusing namespace std;int i=1;class Fun{public:static int i;int 有如下程序: #include<iostream> using namespace std; int i=1; class Fun { public: static int i; int value(){return i-1;} int value()const{return i+1;} }; int Fun::i=2; int main() { int i=3; Fun fun 1; const Fun fun2; ______ return 0; } 若程序的输出结果是: 123 则程序中横线处的语句是( )。A.cout<<fun1.value()<<Fun::i<<fun2.value();B.cout<<Fun::i<<fun1.value()<<fun2.value();C.count<<fun.value()<<fun2.value()<<Fun::i;D.cout<<fun2.value()<<Fun::i<<fun1.value();

有如下程序: include using namespace std; class TestClass { private: int x,y; pu 有如下程序: #include<iostream> using namespace std; class TestClass { private: int x,y; public: TestClass (int i,int j) { x=i; y=j; } void print() { cout<<"print1"<<end1; } void print()const { cout<<"print2"<<end1; } }; int main() { const TestClass a(1,2); a.print(); return 0; } 该程序运行后的输出结果是( )。A.print1B.print2C.print1 print2D.程序编译时出错

有如下程序: #inCludeiostream using namespaCe std; Class Sample{ friend long fun(Sample S); publiC: Sample(10ng A.{x=a;} private: long X; }; long fun(Sample S){ if(S.x2)return l; return S.X*fun(Sample(s.x-1)); } int main( ) { int sum=0; for(int i=0;i6;i++) {sum+=fun(Sample(i));} Coutsum: return 0; } 执行这个程序的输出结果是( )。A.120B.16C.154D.34

有如下程序:includeusing namespaee std;class A{public:A(int i):rl(i){ }void prin 有如下程序: #include<iostream> using namespaee std; class A{ public: A(int i):rl(i){ } void print( ){cout<<'E'<<rl<<'-';} void print( )const}cout<<'C'<<rl*rl<<'-';} private: int rl; }; int main( ){ A al(2);eonst A a2(4); a1.print( );a2.print( ); return 0; } 程序的输出结果是A.运行时出错B.E2-C16-C.C4-C16-D.E2-E4-

如下程序的结果是_____________i=1 while i<=10: i+=1 print(i)