下列程序的执行结果为【 】。include class Point{public:Point(double i, double j) 下列程序的执行结果为【 】。include <iostream. h>class Point{public:Point(double i, double j) { x=i; y=j;}double Area() const { return 0.0;}private:double x, y;};class Rectangle: public Point{public:Rectangle(double i, double j, double k, double 1)double Area() const {return w * h;}private:double w, h;};Rectangle: :Rectangle(double i, double j, double k. double 1): Point(i,j).{w=k, h=1}void fun(Point s){cout<<s. Area()<<end1;}void main( ){Rectangle rec(3.0, 5.2, 15.0. 25.0);fun(rec)}

下列程序的执行结果为【 】。include class Point{public:Point(double i, double j)

下列程序的执行结果为【 】。

include <iostream. h>

class Point

{

public:

Point(double i, double j) { x=i; y=j;}

double Area() const { return 0.0;}

private:

double x, y;

};

class Rectangle: public Point

{

public:

Rectangle(double i, double j, double k, double 1)

double Area() const {return w * h;}

private:

double w, h;

};

Rectangle: :Rectangle(double i, double j, double k. double 1): Point(i,j).

{

w=k, h=1

}

void fun(Point &s)

{

cout<<s. Area()<<end1;

}

void main( )

{

Rectangle rec(3.0, 5.2, 15.0. 25.0);

fun(rec)

}


相关考题:

( 29 )有如下程序:#includeusing namespace std;class point {public:static int number;public:point () {number++;~ point () {number-;}};imt point::number=0;void main () {point*ptr;printA,B;{point*ptr_point=new point{3};ptr=ptr_point;}pointC;coutPOINT::NUMBERENDL;delete[]ptr;}运行时输出的结果是A ) 3B ) 4C ) 6D ) 7

下列程序的输出结果为: Ohject id=0 Object id=1 请将程序补充完整。 include us 下列程序的输出结果为:Ohject id=0Object id=1请将程序补充完整。include <iostream>using namespaee std;class Point{public:Point(int xx=0,intyy=0){X=xx;Y=yy;countP++;}~Point( ){countP--;}int GetX( ){return X;}int GetY( ){return Y;}static void GetC( ){ cout<<"Object id="<<<countP<<endl;}private:int X,Y;static int countP;};______ //静态数据成员的初始化int main( ){Point::GetC( );Point A(4,5);A.GetC( );return 0;}

有如下程序:includeusing namespace std;class Point{public: static int number; 有如下程序:#include<iostream>using namespace std;class Point{public: static int number;public: Point(){number++;} ~Point(){number--;}};int Point::number=0;void main(){ Point*ptr; Point A,B; { Point*ptr_point=new Point[3]; ptr=pb_point; } Point C cout<<Point::number<<endl; delete[]ptr; }运行时输出的结果是A.3B.4C.6D.7

下列程序的输出结果为: bjectid=O biectid=1 请将程序补充完整。 include using namesp 下列程序的输出结果为:bjectid=Obiectid=1请将程序补充完整。include<iostream>using namespace std;class Point{public:Point(int xx=0,int yy=0){X=xx;Y=yy;countP++;}~Point(){countP--;}int GetX(){return X;}int GetY(){return Y;}static void GetC(){cout<<"Object id="<<countP<<endl;}private:int X,Y;static int countP;};______//静态数据成员的初始化int main(){Point::GetC();Point A(4,5);A.GetC();return 0;}

下列程序的输出结果为 Object id=0 Obiect id=1 请将程序补充完整。 include using nam 下列程序的输出结果为Object id=0Obiect id=1请将程序补充完整。include<iostream>using namespace std;class Point{public:Point(int xx=O,int yy=O){X=xx;Y=yy;countP++;}~Point(){countp--;}int GetX()(return X;)int GetY(Xremm Y;)static void GetC(){cout<<"Objcetid="<<countp<<endl;}private:int X,Y;static int countP;}:【 】。 //静态数据成员的初始化int main(){Point::GetC();Point A(4,5);A.GetC()return 0;}

下列程序的输出结果为 Object id=0 Object id=1 请将程序补充完整。 include using na 下列程序的输出结果为Object id=0Object id=1请将程序补充完整。include <iostream>using namespace std;class Point{public:Point(int xx=0,int yy=0) {X=xx;Y=yy;countP++;}~Point(){countP--;}int GetX(){return X;}int GetY(){return Y;}static Void GetC(){cout<<"Object id="<<countP<<endl;}private:int X,Y;static int countP;};______ //静态数据成员的初始化int main (){Point::GetC();Point A(4,5);A.GetC();return 0;}

有如下程序: #inCludeiostream using namespaCe std; Class Point{ publiC: statiC int number; publiC: Point( )t.number++;} ~Point( ){number--;} }; , int P0int::number=0; int main( ){ Point *ptr: Point A,B; Point*ptr_point=new Point[3]; ptr=ptr_point;’ } Point C; CoutPoint:::numberendl; delete[]ptr; return 0; } 执行这个程序的输出结果是( )。A.3B.4C.6D.7

有以下程序:includeincludeusing namespace std; class point{private:double 有以下程序: #include<iostream> #include<math> using namespace std; class point { private: double x; double y; public: point(double a,double B) { x=a; y=b; } friend double distance (point a,point B) ;A.1B.5C.4D.6

分析以下程序的执行结果【】。include class S{ int A[10]; public: int operato 分析以下程序的执行结果【 】。include <iostream. h>class S{int A[10];public:int operator () (int);};int S: :operator() (int x) {return A[x];}void main() {S a;int i,j;for (i=0; i<10; i++)a(i)=i*2;for (i=0; i<10; i++)cout<<a(i)<<" ";cout<<end1; }