网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

以下程序的输出结果是( )。 Option Base 1 Private Sub Command1_Click() Dim a(10),p(3) as Integer k=5 For I-1 to 10 a(i)=I Next I For j=1 to3 p(i)=a(I*j) Next j For I=l to 3 k=k+ p (I)*2 Next I Print k End Sub

A.33

B.28

C.35

D.37


参考答案

更多 “ 以下程序的输出结果是( )。 Option Base 1 Private Sub Command1_Click() Dim a(10),p(3) as Integer k=5 For I-1 to 10 a(i)=I Next I For j=1 to3 p(i)=a(I*j) Next j For I=l to 3 k=k+ p (I)*2 Next I Print k End SubA.33B.28C.35D.37 ” 相关考题
考题 若有以下程序:include using namespace std;class Base{public: void who(){cout 若有以下程序:include <iostream>using namespace std;class Base{public:void who(){cout<<" Base"<<end1:}};class Derived1: public Base{public:void who(){ cout<<"Derived"<<end1;}};int main(){Base *p;Derived1 obj1;p=obj1;p->who();return 0;}则该程序运行后的输出结果是【 】。

考题 有以下程序includeincludeusing namespace std;class base{private:charbas 有以下程序 #include<iostream> #include<string> using namespace std; class base { private: charbaseName[10]; public: base() { strcpy(baseName,"Base"); } virtual char*myName() return baseName; } char *className() { return baseName; } }; class Derived: public base { private: char derivedName[10]; public: Derived() { strcpy(derivedName,"Derived"); } char *myName() { return derivedName; } char *className() { return derivedName; } }; void showPtr(base p) { cout<<p.myName0<<" "<<p.className(); } int main() { base bb; Derived dd; showPtr(dD) ; retum 0; } 动行后的输出结果为A.Derived BaseB.Base BaseC.Derived DerivedD.Base Derived

考题 有以下程序include include using namespace std;class base{private:char 有以下程序 #include <iostream> #include <string> using namespace std; class base { private: char baseName[10]; public: base () { strcpy(baseName,"Base"); } virtual char *myName() { return baseName; } char *className() { return baseName; } }; class Derived : public base { private: char derivedName[10]; public: Derived() { strcpy(derivedName,"Derived"); } char *myName() { return derivedName; } char *className() { return derivedName; } }; void showPtr(base p) { cout<<p.myName () <<" "<<p.className (); } int main () { base bb; Derived dd; showPtr(dd); return 0; } 运行后的输出结果为A.Derived BaseB.Base BaseC.Derived DerivedD.Base Derived

考题 有以下程序include include using namespace std;class base {private:char 有以下程序 #include <iostream> #include <string> using namespace std; class base { private: char baseName[10]; public: base() { strcpy(baseName,"Base"); } virtual char *myName() { return baseName; } char *className() { Return baseName; } }; class Derived: public base { private: char derivedName[10]; public: Derived() { strcpy(derivedName,"Derived" ); } char *myName() { return derivedName; } char *className() { return derivedName; } }; void showPtr(base p) { cout<<p.myName()<<" "<<p.className(); } int main() { base bb; Derived dd; showPtr(dd); return 0; } 运行后的输出结果为A.Derived BaseB.Base BaseC.Derived DerivedD.Base Derived

考题 有以下程序include using namespace std:class Base{private:char c;public:Base(cha 有以下程序#include <iostream>using namespace std:class Base{private: char c;public: Base(char n) :c(n) {} ~Base ( ) { cout<<c; }}; class Derived : public Base{private: char c;public: Derived(char n):Base (n+1),c(n) {} ~Derived() { cout<<c; }};int main(){ Derived obj('x'); return 0;} 执行后的输出结果是A.xyB.yxC.xD.y

考题 如下程序执行后的输出结果是【】。include using namespace std; class Base { public: 如下程序执行后的输出结果是【 】。include <iostream>using namespace std;class Base{public:Base(int x,int y){a=x;b=y;}void Show(){cout<<"Base: "<<a<< ',' <<b<<" ";}private:int a,b;};class Derived : public Base{public:Derived(int x, int y, int z) : Base(x,y),c(z) { }void Show(){cout<<"Derived:"<<c<<end1;}private:int c;};int main(){Base b(100,100),*pb;Derived d(10,20,30);pb=b;pb->Show();pb=d;pb->Show();return 0;}

考题 有以下程序:include using namespace std;class Base{public:Base(){}virtual void w 有以下程序: #include <iostream> using namespace std; class Base { public: Base(){} virtual void who() { cout<<"Base Class"<<end1; } ~Base(){} }; class Derivel : public Base { public: void who() { cout<<"Derivel Class"<<end1; } }; class Derive2 : public Base { public: void who () { cout<<"Derive2 Class"<<end1; } }; int main () { Base *p; Derivel obj1; Derive2 obj2; p=obj1; p=obj2; p->who ( ); return 0; } 执行程序后的输出结果是( )。A.Base ClassB.Derivel ClassC.Derive2 ClassD.程序编译时出错

考题 若有以下程序:include using namespace std;class Base{private: inta,b;public: Bas 若有以下程序: #include <iostream> using namespace std; class Base { private: int a,b; public: Base(int x, int y) { a=x; b=y; } void disp () { cout<<a<<" "<<b<<end1; } }; class Derived : public Base { private: int c; int d; public: Derived(int x,int y, int z,int m) :Base(x,y) { c=z; d=m; } void disp () { cout<<c<<" "<<d<<end1; } }; int main() { Base b(5,5),*pb; Derived obj(1,2,3,4); pb=obj; pb->disp(); return 0; } 执行程序后的输出结果是( )。A.1,2B.3,4C.2,3D.5,5

考题 有以下程序:inClUdeusingnamespacestd;ClassBase{public: Base(intx) {a=x; } voidsh 有以下程序: #inClUde <iostream> using namespace std; Class Base { public: Base(int x) { a=x; } void show() { cout<<a; } private: int a; }; class Derived : public Base { public: Derived(int i) :Base(i+1),b(i){} void Show() { cout<<b; } private: int b; }; int main() { Base b(5),*pb; Derived d(1); pb=d; pb->show(); return 0; } 运行后的输出结果是( )。A.1B.5C.2D.0

考题 有以下程序includeusing namespace std;class Base{private:char c;public:Base(char 有以下程序 #include<iostream> using namespace std; class Base { private: char c; public: Base(char n):c(n){} ~Base() { cout<<c; } }; class Derived:public Base { private: char c; public: Derived(char n):Base(n+1),c(n){} ~Derived() { cout<<c; } }; int main() { Derived obj('x'); return 0; } 执行后的输出结果是A.xyB.yxC.xD.y