填空题
下列程序的输出结果是______。
#include<iostream>
using namespace std;
Class Test
public:
Test()cnt++;
~Test()cnt--;
static int Count()return cnt;
private:
static int cnt;
;
int Test::cnt=0;
int main()
cout<<Test::Count()<<"";
Test t1,t2;
Test*pT3=new Test;
Test*pT4=new Test;
cout<<Test::Count()<<"";
delete pT4;
delete pT3;
cout<<Test::Count()<<end1;
return 0;
【参考答案】
042
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
下列程序的输出结果为 Objectid=O 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<<end1; private: int X,Y; static int countP; ; ______ 静态数据成员的初始化 int main() Point::GetC(); Point A(4,5); A.GetC(); return 0;
点击查看答案&解析
填空题
栈的三种基本运算是入栈、退栈和______。
点击查看答案&解析
相关试题
有如下程序: #include<iostream> usi...
有如下定义: class MA int value; p...
已知递归函数f的定义如下: int f(int ...
程序中有如下语句: for(int i=0;i<...
插入排序算法的主要思想:每次从未排序序列...