0
点赞
收藏
分享

微信扫一扫

程序填空_3

E_topia 2022-06-08 阅读 106

源程序:

#include <iostream>
using namespace std;
int time=0,end=0;
class Test
{
public:
Test()
{
if(time==0) //程序填空
cout<<"欢迎使用测试程序!"<<endl;
time=time+1;
}
~Test()
{
end=end+1;
if(end==time)
cout<<"下次再见!"<<endl;
}
void print()
{
cout<<"共生成过"<<time<<"个对象"<<endl; //程序填空
}
};void main()
{
Test obj1,obj2,obj3;
obj1.print();
}

 结果:

程序填空_3_源程序

 


举报

相关推荐

0 条评论