填空题

使用VC6打开考生文件夹下的工程test24_1,此工程包含一个源程序文件test24_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果为:
000
1 2-1
000
l 2-l
2 1 1
源程序文件 test24_1.cpp 清单如下:
#include<iostream.h>
class A
/****************found*******************/
int a=O;
public:
A(int aa=O):a(aa)
;
class B

int a,b;
const int c;
A d;
public:
/****************found*******************/
B()
/****************found*******************/
B (int aa, int bb): d(aa+bb)

a=aa, b=bb;

void print()

cout<<a<<" "<<b<<" "<<c<<" "<<endl;

;
void main ( )

B a,b(1,2);
B x=a,y(b),z(2,1);
a.print();
b.print();
x.print();
y.print();
z.print();

【参考答案】


(A)错误:int a=0;
正确:int a;
(B)错误;B(){}
......

(↓↓↓ 点击下方‘点击查看答案’看完整答案、解析 ↓↓↓)