填空题
使用VC++6.0打开考生文件夹下的源程序文件1.cpp,该程序运行时有错,请改正其中的错误,使程序正确运行,其输出的结果为
30
130
注意:错误的语句在//******error******的下面,修改该语句即可。
试题程序:
#include<iostream.h>
int a=10;
class
TC
{
public:
TC()
{
a=b=0;
}
void
display()
{
//******error******
cout<<a<<b<<end1;
}
void func(int
a)
{
//******error******
a+=a;
}
void func2()
{
//******error******
a+=a;
}
private:
int a,b;
};
void main()
{
TC
obj;
obj.func(3);
obj.display();
obj.func2();
obj.display();
}