使用VC6打开考生文件夹下的工程test18_1,此工程包含一个源程序文件test18_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下: Enter x and y: -4 -5 xoffset=1 yoffset=1 angle=45 radius=1.41421 源程序文件test18_1.cpp 清单如下: #include <iostream.h> #include <math.h> class point
public: void set(double ix,double iy)
x=ix; y=iy;
double xoffset()
return x;
double yoffset()
return y;
double angle ( )
return (180/3.14159)*atan2(y,x);
/**************** found *******************/ inline radius ( )
return sqrt(x*x+y*y);
protected: double x; double y; ; void main()
point p; double x,y; cout<<"Enter x and y:\n"; cin>>x>>y; p.set(x,y); /**************** found *******************/ p.x+=5; p.y+=6; /**************** found *******************/ cout<<"xoffset="<<p.xoffset()<<end1; cout<<"yoffset="<<p.yoffset()<<end1; cout<<"angle="<<p.angle()<<end1; cout<<"radius="<<p.radius()<<end1;