填空题
C++
题号 #1545495
下列程序输出结果为012,请根据注释将横线处的缺失部分补充完整。
#include<iostream>
using namepace std;
class Test{
public:
Test(int a){data=a;}
~Test(){}
void print(){cout<<data;}
private:
int data;
};
int main() {
Test t[3]={ };//对有3个元素的Test类对象数组 t 初始化
for(int i=0;i<3;i++) t[i].print();
return 0;
}
参考答案
暂无
答案解析
解析:因为Test类的对象数组 t 包含 3 个元素,所以对其初始化的形式为 {0,1,2}。



