Demo entry 6745066



Submitted by anonymous on May 25, 2018 at 14:52
Language: C++. Code size: 724 Bytes.

#include <iostream>
#include <cmath>
using namespace std;
#include "point.h"
double Point::PI=3.1415926; 
double Point::disToOrigin()
	return sqrt(x*x+y*y);
Point::Point(double a,double b){x=a;y=b;}
double Point::xOffset()const {return x;}
double Point::yOffset()const {return y;}
double Point::angle()const {return atan(y/x);}
double Point::radius()const {return sqrt(x*x+y*y);}
Point Point::operator+(const Point& d)const
	Point p=(*this);
	return p;
Point& Point::operator+=(const Point& d)
	return *this;
void Point::moveTo(double a,double b){x=a;y=b;}//点的坐标变成(a,b)
ostream& operator<<(ostream& o,const Point& d)
	return o<<'('<<d.x<<','<<d.y<<')'; 

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).