C++程序填空题三道 100

填程序题1.Thefollowingprogramusestaticdatamemberobj_counttocountthetotalnumberoftheobject... 填程序题
1. The following program use static data member obj_count to count the total number of the objects that have been created, please fill in the blanks.
#include<iostream>
___________________
class CL
{ static int obj_count;
int x;
___________________
CL() { obj_count++;}
CL(int i){ x=i; obj_count++;}
~CL() { obj_count--; }
static int get_num()
{ return obj_count; }
};
____________________
void main()
{ CL a1;
CL a2(10);
CL a3[10];
cout<<CL::get_num()<<endl;
}
2.The following program use array to sort the 10 numbers that input from the keyboard by ascending(升序),please fill in the blanks.
#include<iostream>
using namespace std;
void main()
{
int a[10],i,j,temp;
for(i=0;i<=9;i++)
_____________
for(i=0;i<10;i++)
for(j=0;j<10-i-1;j++)
________________
{ temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
for(i=0;i<=9;i++)
cout<<a[i]<<endl;
}
3.class A{
int i;
public:
A(int ii){
_____________;
cout<<”The constructor is called”<<endl;
}
A(_____________){
Cout<<”the copy constructor is called”<<endl;
}
~A(){
cout<<”The destructor is called”
}
};
void main(){
A a(3);
A b=a;
}
请给出具体答案,并说明填空的原理和考点,最好给出一些例子,说明越明白详细,越好。谢谢。
展开
 我来答
kaiyuankj
2009-01-01 · TA获得超过164个赞
知道答主
回答量:50
采纳率:0%
帮助的人:32.7万
展开全部
一楼的很棒!
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
kesyn
2009-01-01 · TA获得超过478个赞
知道小有建树答主
回答量:376
采纳率:0%
帮助的人:306万
展开全部
同意一楼,二楼叙述解释多半不是很正确,支持三楼
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式