使用VC6打开考生文件夹下的工程test1_1,此工程包含一个源程序文件test1_1.cpp,但该程序运行有问题,请改正main函数中的错误,使该程序的输出结果如下:
Constructor called.
Default constructor called.
Area is 6
Area is 0
Area is 6
源程序文件test1_1,cpp清单如下:
#include<iostream.h>
class RectAngle
private:
double ledge,sedge;
public:
RectAngle()
cout<<"Default constructor called.";
RectAngle(double l,double s)
ledge=l;sedge=s;
cout<<"Constructor called.";
void Set(double l,double s)
ledge=l;sedge=s;
void Area()
cout<<"Area is"<<ledge*sedge<<endl;
;
void main()
/***************** found *****************/
RectAngle Rect1(2,3);
RectAngle Rect2(1);
/**************** found *****************/
RectAnglC Rect3;
Rectl.Area();
/***************** found *****************/
RecL2.lodge=0;Rect2.sedge=0;
Reck2.Area();
Rect3.Area();