the code :
std::ostream& operator << (std::ostream& out, point p) {
out << "(" << p.x << ", "<< p.y<< ", "<< p.z << ")";
return out;
}
the error:
‘std::ostream& KillThemAll::point::operator<<(std::ostream&, KillThemAll::point)’ must take exactly one argument std::ostream& operator<< (std::ostream& out, point p) { out << "(" << p.x << ", "<< p.y<< ", "<< p.z << ")"; return out;}
actualy, the code is similar at the one p.402 of « Problems & Solutions In Scientific Computing » (except I'm using 3D instead of 2D).
for your curiosity, here the mighty structure « point » :
struct point{
double x,y,z;
point() { x=y=z=0.0;}
point(double _x, double _y, double _z){this->x=_x, this->y=_y, this->z=_z;}
point operator - (const point& _p) const { return point(x-_p.x, y-_p.y, z-_p.z);}
point operator + (const point& _p) const { return point(x+_p.x, y+_p.y, z+_p.z);}
double operator * (const point& _p) const { return x*_p.x+y*_p.y+z*_p.z;}
point operator * (const double _t) const { return point(_t*x, _t*y, _t*z);}
point operator / (const double _t) const { if(_t!=0) return point(x/_t, y/_t, z/_t);}
};