(23)下列程序运行时输出的结果是 Option Base 1 Const a=10 Priate Sub Form_Click() Dim x(a) As Integer k=-1 For i=1 To a x(i)=i*k k=(-1)*k Next i For i=1 To 10 Print x(i) Next i End Sub A.1 3 5 7 9 10 B.-1 -3 -5 -7 -9 C.-1 2-3 4-5 6-7 8-9 10 D.1-2 3-4 5-6 7-8 9-10
(23)下列程序运行时输出的结果是 Option Base 1 Const a=10 Priate Sub Form_Click() Dim x(a) As Integer k=-1 For i=1 To a x(i)=i*k k=(-1)*k Next i For i=1 To 10 Print x(i) Next i End Sub A.1 3 5 7 9 10 B.-1 -3 -5 -7 -9 C.-1 2-3 4-5 6-7 8-9 10 D.1-2 3-4 5-6 7-8 9-10
相关考题:
( 28 )有如下程序:#includeiostreamusing namespace std;class MyClass{public:MyClass(int x):val(x) {}void Print() const {cout"const:val="val'\t';}void Print(){cout"val="val't';}private:int val;};int main(){const MyClass obj1(10);MyClass obj2(20);obj1.Print();obj2.Print();return 0;}程序的输出结果是A ) val=10 const:val=20B ) const:val=10 const:val=20C ) const:val=10 val=20D ) val=10 val=20
有如下程序: #include using name space std; classB{ public: B(int xx):x(xx){++count;x+=10;} virtual void show()const {cout<<count'_'<<x<<endl;} protected: static int count; private: intx; }; class D:publicB{ public: D(int xx,int yy):B(xx),y(yy){++count;y+=100;} virtual void show()const {cout<<count<<'_'<<y<endl}; pnvate: inty; }; int B::count=0; intmain(){ B*ptr=new D(10,20); ptr-show(); delete ptr; return 0; } 运行时的输出结果是( )。A.1_120B.2_120C.1_20D.2_20
已知下列程序的输出结果是23,请将横线处缺失的部分补充完整。 include using namespace 已知下列程序的输出结果是23,请将横线处缺失的部分补充完整。include<iostream>using namespace std;class MyClass{public:void Print()const{cout<<23;}};int main(){MyClass*p=new MyClass();______.Print();return 0;}
有如下程序: include using namespace std; class Base{ int x; pu 有如下程序: #include<iostream> using namespace std; class Base{ int x; public: Base(int n=0):x(n){cout<<n;) int getX()const{return x;} }; class Derived:public Base{ int y; public: Derived(int m,int n):y(m,)Base(n){cout<<m;} Derived(int m):y(m){cout<<m;} }; int main(){ Derived d1(3),d2(5,7) return 0; }运行时的输出结果是A.375B.357C.375D.357
有如下程序: #includeiostream usingnamespacestd; classMyClass{ public: MyClass(intx):val(x){} voidPrint()const{cout"const:val="val\t;} voidPrint(){cout"val="valt;} private: intval; }; intmain(){ constMyClassobj1(10); MyClassobj2(20);obj1.Print(); obj2.Print(); return0; } 程序的输出结果是( )。A.va1=10const:va1=20B.const:va1=10const:va1=20C.const:va1=10val=20D.val=10va1=20
有如下程序:includeusing namespace std;class MyClass{public: MyClass(int x):val( 有如下程序: #include<iostream> using namespace std; class MyClass{ public: MyClass(int x):val(x) {} void Print() const {cout<<"const:val="<<val<<'\t';} void Print() {cout<<"val="<<val<<'t';} private: int val; }; int main() const MyClass obj1(10); MyClass obi2(20); obj1.Print(); obj2.Print(); return 0; } 程序的输出结果是( )。A.val=10 const:val=20B.const:val=10 const:val=20C.const:val=10 val=20D.val=10 val=20
有如下程序:#includeiostreamusingnamespacestd;classMyClass{public:MyClass(intx):val(x){}voidPrint()const{coutconst:val=val\t;}voidPrint(){coutval=valt;}private:intval;};intmain(){constMyClassobj1(10);MyClassobj2(20);obj1.Print();obj2.Print();return0;}程序的输出结果是( )。A.va1=10const:va1=20B.const:va1=10const:va1=20C.const:va1=10val=20D.val=10va1=20
有如下程序: #includeiostream usingnamespacestd; classB{ public: B(intxx):x(xx){++count;x+=10;} virtualvoidshow( )const {coutcountxendl;} protected: staticintcount; private: intx; }; classD:publicB{ public: D(intxx,intyy):B(XX),y(yy){++count;y+= 100;) virtualvoidshow( )const {coutcountyendl); private: inty; }; intB::count==0; intmain( ){ B*ptr=newD(10,20); ptr-show( ); deleteptr; return0; } 运行时的输出结果是( )。A.1_120B.2_120C.1_20D.2_20
下列程序的输出结果是______。 include using namespace std; class base { public: in 下列程序的输出结果是______。include<iostream>using namespace std;class base{public:int n;base(int x){n=x;}virtual void set(int m){n=m;cout<<n<<'';}};class deriveA:public base{public:deriveA(int x):base(x){}void set(int m){n+=m;cout<<n<<'';}};class deriveB:public base{public:deriveB(int x):base(x){}void set(int m){n+=m;cout<<n<<'';}};int main( ){deriveA d1(1);deriveB.d2(3);base*pbase;pbase=d1;pbase->set(1);pbase=d2;pbase->set(2);return 0;}
下列程序的输出结果是______。 include class base { int x,y; public: base(int i,i 下列程序的输出结果是______。include<iostream.h>class base{int x,y;public:base(int i,int j){x=i;y=j;}virtual int add( ){return x+y;}};class three:public base{int z;public:three(int i,int j,int k):base(i,j){z=k;)int add( ){return(base::add( )+z);}};void main( ){three*q=new three(10,20,30);cout<<q->add( )<<endl;}