错误很多,求解
#include<iostream.h>class Piont
{
public:
Point(float x=0 ,float y=0 )
void setPoint(float,float);
float getx()const{return x;}
float gety()const {return y;}
friend ostream & operator<<(ostream &,const Point &);
protected:
float x,y;
};
Point::Point(float a,float b)
{
x=a;y=b;
}
void Point::setPoint(float a ,float b)
{
x=a;y=b;
}
ostream & operator<<(ostream &output,const Point & p)
{
output<<p.x<<"."<<p.y<<endl;
return output;}
class Circle:public Point
{
public:
Circle(float x=0,float y=0,float r=0);
void setRadius(float);
float getRadius()const;
float area()const;
friend ostream &operator<<(ostream &,const Circle &);
private:
float radius;
};
Circle::Circle(float a,float b,float r):Point(a,b)
{radius=r;}
void Circle::setRadius(float r)
{ radius=r;}
float Circle::getRadius()const{return radius;}
float Circle::area()const
{return 3.14159*radius*radius;}
ostream & operator<<(ostream & output,const Circle &c)
{output<<"Center="<<c.x<<","<<c.y<<"r="<<c.radius<<","<<"area="<<c.area()<<endl;
return output;}
int main()
{
Point p(3,6);
cout<<p.getx()<<","<<p.gety()<<endl;
p.setPoint(8,9);
cout<<"p(new):"<<p<<endl;
Circle c(1,2,3);
cout<<"x="<<c.getx()<<","<<c.gety()<<"r="<<getRadius<<endl;
cout<<c.setRadius(float 5)<<endl;
cout<<c;
return 0;
}