1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <vector>
using namespace std;
enum CS{
Polar = 0,
Cartesian = 1
};
class point{
public:
char _PointName;
int _System;
double _x;
double _y;
public:
point(char PointName, int System, double x, double y):_PointName(PointName), _System(System), _x(x), _y(y){;}
point(const point& p): _PointName(p._PointName), _System(p._System), _x(p._x), _y(p._y){;}
point& operator=(const point& p){
_PointName = p._PointName;
_System = p._System;
_x = p._x;
_y = p._y;
}
char& name() {return _PointName;}
int& system() {return _System;}
double& x() {return _x;}
double& y() {return _y;}
~point(){;}
};
class Ppoint: public point{
public:
double _r;
double _theta;
public:
Ppoint(char PointName, int System, double r, double theta): _PointName(PointName), _System(System), _r(r), _theta(theta), _x(r*cos(theta)), _y(r*sin(theta)){;}
Ppoint(const Ppoint& p): point(p), _r(p._r), _theta(p._theta){;}
Ppoint& operator=(const Ppoint& p){
point::operator=(p);
_r = p._r;
_theta = p._theta;
}
~Ppoint(){;}
double r(){return _r;}
double theta(){return _theta;}
};
|