( 29 )有如下程序:
#include
using 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;
cout<<POINT::NUMBER<<ENDL;
delete[]ptr;
}
运行时输出的结果是
A ) 3
B ) 4
C ) 6
D ) 7
第1题:
有如下程序: #inClude<iostream> 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; Cout<<Point:::number<<endl; delete[]ptr; return 0; } 执行这个程序的输出结果是( )。
A.3
B.4
C.6
D.7
第2题:
有以下程序: #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.314
B.157
C.78.5
D.153.86
第3题:
第4题:
请将如下程序补充完整,使得输出结果为:bbaa。
include<iostream>
using naluespace std;
class A{
public:
______{eout<<"aa";}
};
class B:public A{
public:
~B( ){eont<<"bb";}
};
int ulain( ){
B*P=new B;
delete P;
return 0;
}
第5题: