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

题目内容 (请给出正确答案)
若有以下程序:include using namespace std;class A{private: int a;public: A(int i

若有以下程序: #include <iostream> using namespace std; class A { private: int a; public: A(int i) { a=i; } void disp() { cout<<a<<", "; } }; class B { private: int b; public: B(int j) { b=j; } void disp() { cout<<b<<", "; } }; class C : public B,public A { private: int c; public: C int k) :A(k-2),B(k+2) { c=k; } void disp() { A: :disp (); B::disp(); cout<<c<<end1; } }; int main () { C ebj (10); obj .disp (); return 0; } 程序执行后的输出结果是( )。

A.10,10,10

B.10,12,14

C.8,10,12

D.8,12,10


参考答案

更多 “ 若有以下程序:include using namespace std;class A{private: int a;public: A(int i 若有以下程序: #include <iostream> using namespace std; class A { private: int a; public: A(int i) { a=i; } void disp() { cout<<a<<", "; } }; class B { private: int b; public: B(int j) { b=j; } void disp() { cout<<b<<", "; } }; class C : public B,public A { private: int c; public: C int k) :A(k-2),B(k+2) { c=k; } void disp() { A: :disp (); B::disp(); cout<<c<<end1; } }; int main () { C ebj (10); obj .disp (); return 0; } 程序执行后的输出结果是( )。A.10,10,10B.10,12,14C.8,10,12D.8,12,10 ” 相关考题
考题 有以下程序:includeusing namespace std;class A{private:int a;public:A(int i){a=i 有以下程序: #include<iostream> using namespace std; class A {private: int a; public: A(int i) {a=i;} void disp() {cout<<a<<“,”;}}; class B {private: int b; public: B(int j) {b=j;} void disp() {cout<<b<<“,”;A.10,10,10B.10,12,14C.8,10,12D.8,12,10

考题 若有如下程序:includeusing namespace std;Class TestClass1{private:int a;public:T 若有如下程序: #include<iostream> using namespace std; Class TestClass1 { private: int a; public: TestClassl(int i) { a=i; } void disp() { cout<<a<<“,”; } }; Class TestClass2 { private: int b; publicA.10,10,10B.10,12,14C.8,10,12D.8,12,10

考题 程序的输出结果是【 】。 include using namespace std; class A{ public: A(){a=b=2;} 程序的输出结果是【 】。include <iostream>using namespace std;class A{public:A(){a=b=2;}A(int i,int j){a=i;b=j;}void display(){cout<<a<<b;}private:int a,b;};void main(){A m,n(4,8);m.display();n.display();}

考题 若有以下程序 include using namespace std; class A {private:int a; public: A(in 若有以下程序 #include <iostream> using namespace std; class A { private: int a; public: A(int i) { a=i; } void disp() { cout<<a<<","; } }; class B { private: int b; public: B(int j) { b=j; } void disp() { cout<<b<<","; } }; class C: public B,public A { private: int c; public: C(int k):A(k-2),B(k+2) { c=k; } void disp() { A::disp(); B::disp(); cout<<c<<end1; } }; int main() { C obj(10); obj.disp(); return 0; } 程序执行后的输出结果是A.10,10,10B.10,12,14C.8,10,12D.8,12,10

考题 有以下程序:include using namespace std;class A{private:int a;public:A (int i){a 有以下程序: #include <iostream> using namespace std; class A { private: int a; public: A (int i) { a=i; } void disp() { cout<<a<<","; } }; class B { private: int b; public: B(int j) { b=j; } void disp() { cout<<b<<","; } }; class C : public B,public A { private: int c; public: C(int k) :A(k-2),B(k+2) { c=k; } void disp () { A::disp (); B::disp (); cout<<c<<endl; } }; int main () { C obi (10); obj.disp (); return 0; } 程序执行后的输出结果是A.10,10,10B.10,12,14C.8,10,12D.8,12,10

考题 若有以下程序:include using namespace std;class A{private:int x;public:int z;voi 若有以下程序:#include <iostream>using namespace std;class A{private: int x;public: int z; void setx(int i) { x=i; } int getx() { return x; }};class B: public A{private: int m;public: int p; void setvalue(int a, int b, int c) { setx(a); z=b; m=c; } void display() { cout<<getx()<<","<<z<<","<<m<<end1; }};int main(){ B obj; obj.setvalue(2,3,4); obj.display(); return 0;程序运行以后的输出结果是( )A.产生语法错误B.2,3,4C.2,2,2D.4,3,2

考题 以下程序的执行结果是 ( )。include using namespace std;class sample{private: int 以下程序的执行结果是 ( )。 #include <iostream> using namespace std; class sample { private: int x; public: sample (int A) { x=a; } friend double square(sample s); }; double square(sample s) {A.20B.30C.900D.400

考题 若有以下程序:include using namespace std;class A{private:int a;public:A(im i){a 若有以下程序: #include <iostream> using namespace std; class A { private: int a; public: A(im i) { a=i; } void disp() cout<<a<<","; } }; class B { private: int b; public: B(int j) { b=j; } void disp0 { cout<<b<<","; } }; class C: public B,public A { private: int c; public: C(int k):A(k-2),B(k+2) { c=k; } void disp0 { A::disp(); B::disp(); cout<<c<<endl; } }; int main() { C obj(10); obj.disp(); return 0; } 程序执行后的输出结果是( )。A.10,10,10B.10,12,14C.8,10,12D.8,12,10

考题 下面程序的打印结果是【】。 include using namespace std; class Base { public:Base(i 下面程序的打印结果是【 】。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;}

考题 有以下程序:includeusing namespace std;definePl 3.14Class Point{private:int x,y 有以下程序: #include<iostream> using namespace std; #definePl 3.14 Class Point {private: int x,y; public: Point(int a,intB) {X=a; y:b;} int getx() <return x;} int gety() {return y;}}; class Circle:public Point {priA.314B.157C.78.5D.153.86

考题 有以下程序:include using namespace std;int s=0;class sample{ static int n;publi 有以下程序: #include <iostream> using namespace std; int s=0; class sample { static int n; public: sample (int i) { n=i; } static void add() { s+=n; } }; int sample::n=0;A.2B.5C.7D.3

考题 若有以下程序: include usingnamespace std; class Sample { private: const int n; 若有以下程序:include <iostream>using namespace std;class Sample{private:const int n;public:Sample(int i) :n(i) {)void print(){cout<<"n="<<n<<end1;}};int main(){sample a(10);a.print();return 0;}上述程序运行后的输出结果是【 】。

考题 若有以下程序:include using namespace std;class A{private: int x;protected: int 若有以下程序: #include <iostream> using namespace std; class A { private: int x; protected: int y; public: int z; void setx(int i) { x=i; } int getx () { return x; }; class B : protected A { public: void setvalue(int a, int b, int c) { setx (a); y=b; z=c; } void display() { cout<<getx ( ) <<", "<<y<<", "<<z<<", "<<end1; } }; int main () { B obj; obj.setvalue(5, 6, 7); obj.display ( ); return 0; } 程序运行后的输出结果是( )。A.产生语法错误B.7,6,5C.5,6,7D.7,5,6

考题 若有以下程序:include using namespace std;class myClass{private: int var;public: 若有以下程序: #include <iostream> using namespace std; class myClass { private: int var; public: myClass(int i) { var=i; } void add() { s+=var; } static int s; void display() { cout<<s<<end1; } }; int myClass::s=0; int main ( ) { myClass a(1),b(2),c(3); a.add(); b.add(); c.dislay(); return O; } 程序执行后的输出结果是( )。A.1B.4C.3D.7

考题 若有以下程序:include using namespace std;class Base{private: int a,b;public: Ba 若有以下程序: #include <iostream> using namespace std; class Base { private: int a,b; public: Base(int x, int y) { a=x; b=y; } void show() { cout<<a<<", "<<b<<end1; } }; class Derive : public Base { private: int c, d; public: Derive(int x, int y, int z,int m):Base(x,y) { c=z; d=m; } void show() { cout<<c<<", "<<d<<end1; } }; int main ( ) { Base b(50,50) ,*pb; Derive d(10,20,30,40); pb=d; pb->show {); return 0; }A.10,20B.30,40C.20,30D.50,50

考题 若有以下程序include using namespace std;class A{public: A(int i,int j) {a=i;b=j 若有以下程序 #include <iostream> using namespace std; class A { public: A(int i,int j) { a=i; b=j; } void move(int x, int y) { a+=x; b+=y; } void show() { cout < <a < <" , " <<b<< end1; } private: int a,b; }; class B : private A { public: B(int i,int j) :A(i,j) {} void fun ( ) { move (3, 5); } void f1 ( ) { A::show(); } }; int main ( ) { B d(3,4); d. fun ( ); d.f1(); return 0; } 程序执行后的输出结果是 ( )。A.3,4B.6,8C.6,9D.4,3

考题 若有以下程序:include using namespace std;class A{private:int a;public:A(int i){ 若有以下程序: #include <iostream> using namespace std; class A { private: int a; public: A(int i) { a=i; } void disp () { cout<<a<<","; } }; class B { private: int b; public: B(int j) { b=j; } void disp () { cout<<b<<","; } }; class C : public B,public A { private: int c; public: C(int k):A(k-2),B(k+2) { c=k; } void disp () { A::disp(); B::disp(); cout<<c<<endl; } }; int main() { C obj(10); obj.disp(); return 0; }A.10,10,10B.10,12,14C.8,10,12D.8,12,10

考题 若有以下程序:include using namespace std;define PI 3.14class Point{private: in 若有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int b) { x=a; y=b; } int getx() { return x; } int gety() { return y; } }; class Circle : public Point { private: int r; public: Circle(int a, int b,int c) :Point(a,b) { r=c; } int getr() { return r; } double area() { return PI*r*r; } }; int main() { Circle c1(5,7,10); cout<<c1.area()<<end1; return 0; } 程序执行后的输出结果是( )。A.314B.157C.78.5D.153.86

考题 若有以下程序:includeusing namespace std;class A{private:int a;public:A(int i){a 若有以下程序: #include<iostream> using namespace std; class A {private: int a; public: A(int i) {a=i;} void disp() {cout<<a<<“,”;}}; class B {private: int b; public: B(int j {b=j;} void disp() {cout<<b<<A.10,10,10B.10,12,14C.8,10,12D.8,12,10

考题 有以下程序:include using namespace std;define PI 3.14class Point{ private:int 有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int b) { x=a; y=b; } int getx() { return x; }A.314B.157C.78.5D.153.86

考题 若有以下程序:includeusing namespace std;class A{public:A(int i,int j){a=i;b=j;} 若有以下程序: #include<iostream> using namespace std; class A { public: A(int i,int j) { a=i; b=j; } void move(int x,int y) { a+=x; b+=y; } void show() { cout<<a<<","<<b<<endl; } private: int a,b; }; class B:private A { public: B(int i,int j):A(i,j){} void fun() { move(3,5); } void fl() { A::show(); } }; int main() { B d(3,4); d.fun(); d.fl(); return 0; } 程序执行后的输出结果是( )。A.3,4B.6,8C.6,9D.4,3

考题 若有以下程序:include using namespacestd;class A {private: int a;public:A(int i) 若有以下程序: #include <iostream> using namespace std; class A { private: int a; public: A(int i) { a=i; } void disp() { cout <<a<<","; } }; class B { private: int b; public: B(int j) { b=j; } void disp() { cout<<b<<","; } }; class C: public B,public A { private: int c; public: C(int k):A(k-2),B(k+2) { c=k; } void disp() { A::disp(); B::disp(); cout<<c<<end1; } }; int main() { C obj (10); obj.disp(); return 0; } 程序执行后的输出结果是A.10,10,10B.10, 12,14C.8,10,12D.8,12,10

考题 若有以下程序:include using namespace std;class point{private: int x, y;public: 若有以下程序: #include <iostream> using namespace std; class point { private: int x, y; public: point ( ) { x=0; y=0; } void setpoint(int x1,int y1) { x=x1; y=y1;A.12,12B.5,5C.12,5D.5,12

考题 若有以下程序:include using namespace std;class Base{private: int x;protected: i 若有以下程序: #include <iostream> using namespace std; class Base { private: int x; protected: int y; public: int z; void setx(int i) { x=i; int getx () { return x; } }A.1,2,3,4B.产生语法错误C.4,3,2,1D.2,3,4,5

考题 若有以下程序:include using namespace std;define PI 3.14class Point {private: i 若有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int B) { x=a; y=b; } int getx() { return x; } int gety() { reurn y; } }; class Circle: public Point { private: int r; public: Circle(int a,int b.int C) :Point(a,B) r=c; int getr() { return r; } double area() { return PI*r*r; } }; int main() { Circle cl(5,7,10); cout<<c 1 .area()<<end1; return 0; } 程序执行后的输出结果是A.314B.157C.78.5D.153.86

考题 若有以下程序:includeusing namespace std;class A{private:int x;public:int z;void 若有以下程序:#include<iostream>using namespace std;class A {private: int x;public: int z; void setx(int i) { x=i; } int getx () { return x; }}:class B : public A{private: int m;public: int p; void setvalue(int a, int b, int c) { setx(a) ; z=b; m=c; } void display{) { cout<<getx ()<<", "<<z<<", "<<m<<end1; }};int main(){ B obj; obj. setvalue(2,3,4); obj.display(); return 0;} 程序运行以后的输出结果是A.产生语法错误B.2,3,4C.2,2,2D.4,3,2

考题 若有以下程序:include using namespace std;class A{private: int a;public: A(int 若有以下程序: #include <iost ream> using namespace std; class A { private: int a; public: A(int i) { a=i; } void disp () { cout<<a<<", "; } }; class B { private:A.10,10,10B.10,12,14C.8,10,12D.8,12,10