下列程序的执行结果是( )。 #includeiostream.h classSample { intx,y; public: Sample(){x=y=0;} Sample(inta,intb){x=a;y=b;} ~Sample() { if(x==y) cout"x=y"endl; else cout"x!=y"endl; } voiddisp() { cout"x="x",y="yendl;} }; voidmain() { Samples1(2,3); s1.disp(); }A.x=2,y=2B.x=3,y=3C.x=2,y=3D.x=3,y=2

下列程序的执行结果是( )。 #include<iostream.h> classSample { intx,y; public: Sample(){x=y=0;} Sample(inta,intb){x=a;y=b;} ~Sample() { if(x==y) cout<<"x=y"<<endl; else cout<<"x!=y"<<endl; } voiddisp() { cout<<"x="<<x<<",y="<<y<<endl;} }; voidmain() { Samples1(2,3); s1.disp(); }

A.x=2,y=2

B.x=3,y=3

C.x=2,y=3

D.x=3,y=2


相关考题:

有以下程序: include using namespace std; class sample {int x; public:void setx( 有以下程序:include <iostream>using namespace std;class sample{int x;public:void setx(int i){x=i;}int putx (){return x;}};int main ( ){sample *p;sample A[3];A[0] .set>:(5);A[1] .setx(6);A[2] .setx(7);for (int j=0;j<3;j++){p=A[j];cout<<p->putx () <<", ";}cout<<end1;return 0;}执行后的输出结果是【 】。

下列程序的执行结果是()。includeclass Sample{int x,y;public:Sample(){x=y=0;)Sam 下列程序的执行结果是( )。 #include<iostream.h> class Sample { int x,y; public: Sample(){x=y=0;) Sample(int a,int b){x=a;y=b;} ~Sample() { if=(x==y) cout<<“x=y”<<endl; else cout<<“x!=y”<<endl; } void disp() { coutA.x=2,y=2B.x=3,y=3C.x=2,y=3D.x=3,y=2

以下程序的执行结果是______。 inelude class Sample { public: int x; int y; void 以下程序的执行结果是______。inelude<iostream.h>class Sample{public:int x;int y;void disp( ){cout<<"x="<<x<<",y="<<y<<endl;}};void main( ){int Sample::*pc;Sample s;pc=Sample::x;s.*pc=10;pc=Sample::y;s.*pc=20;s.disp( );}

以下程序的执行结果是【】。includeincludeclass Sample{ public: int x,y; 以下程序的执行结果是【 】。include<iostream.h>include<stdlib.h>class Sample{public:int x,y;Sample(){x=y=0;}Sample(int a,int b) {x=a;y=b; }void disp(){cout<<"x="<<x<<",y="<<y<<end1;}};void main() {Sample s1(2,3);s1.disp();}

下列程序的运行结果是【】。 include class Sample {int x,y;public:Sample() {x=y=0 下列程序的运行结果是【 】。include <iostream. h>class Sample {int x,y;public:Sample() {x=y=0; }Sample(int a, int b) {x=a;y=b;}void disp() {cout<<" x=" <<x<<" , y="<<y<<end1;}};void main() {Sample s1, s2(1, 2);s1. disp0;s2. disp ();}

以下程序的执行结果是 ( )。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 class Sample { public: int x: int y; void di 以下程序的执行结果是【 】。include<iostream. h>class Sample{public:int x:int y;void disp(){cout<<"x="<<x<<",y="<<y<<end1;}};void main(){int Sample:: ** pc;Sample s;pc= Sample: :x;s.*pc=10;pc:=Sample: :y;s.*pc=20;s.disp();}

下列程序的执行结果是()。 includeclass Sample{ int x,y; public: Sample() {x=y=0 下列程序的执行结果是( )。 #include<iostream.h> class Sample { int x,y; public: Sample() {x=y=0;} Sample(int a,int b) {x=a;y=b;} ~Sample() { if(x==y) cout<<"x=y"<<end1; else cout<<"x!=y"<<end1; } void disp() { cout<<"x="<<x<<",y="<<y<<end1; } }; void main() { Sample s1(2,3); s1.disp(); }A.x=2,y=2B.x=3,y:3C.x=2,y=3D.x=3,y=2

有如下程序:include using namespace std;class sample{private: int x, y;public: s 有如下程序: #include <iostream> using namespace std; class sample { private: int x, y; public: sample(int i,int j) { x=i; y=j; } void disp() { cout<<"displ"<<end1; } void disp() const { cout<<"disp2"<<end1; } }; int main () { const sample a(i,2); a.disp (); return 0; } 该程序运行后的输出结果是( )。A.disp1B.disp2C.disp1 disp2D.程序编译时出错

以下程序的执行结果是()。includetemplateclass Sample{ T n;Public: Samp 以下程序的执行结果是( )。 #include<iostream.h> template<class T> class Sample { T n; Public: Sample (T i){n=i;) void operator ++(); void disp() {cout<<"n="<<n<<endl;} }; template<class T> void Sample<T>:: opetatA.n=aB.a=OC.n=bD.a=b