mramine364

complex.h

Jul 4th, 2016
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.26 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. class complex
  6. {
  7.     float x, y;
  8. public:
  9.     complex(float x, float y);
  10.     complex(float x) :complex(x, 0){}
  11.     complex() :complex(0, 0){}
  12.     complex(const complex &z) : complex(z.x, z.y) {}
  13.     ~complex();
  14.  
  15.     float re(){ return this->x; }
  16.     void setX(float x){ this->x = x; }
  17.     float im(){ return this->y; }
  18.     void setY(float y){ this->y = y; }
  19.  
  20.     float abs();
  21.     complex* conjugate();
  22.  
  23.     complex* operator+(const complex&);
  24.     complex* operator-(const complex&);
  25.     complex* operator*(const complex&);
  26.     complex* operator/(const complex&);
  27.     complex* operator+(float);
  28.     complex* operator-(float);
  29.     complex* operator*(float);
  30.     complex* operator/(float);
  31.  
  32.     complex* operator+=(const complex&);
  33.     complex* operator-=(const complex&);
  34.     complex* operator*=(const complex&);
  35.     complex* operator/=(const complex&);
  36.     complex* operator+=(float);
  37.     complex* operator-=(float);
  38.     complex* operator*=(float);
  39.     complex* operator/=(float);
  40.  
  41.     complex* operator==(const complex&);
  42.     complex* operator!=(const complex&);
  43.  
  44.     complex* reciprocal();
  45.     complex* e();
  46.     complex* sinus();
  47.     complex* cosinus();
  48.     complex* tangent();
  49.  
  50.     friend ostream& operator<<(ostream&, const complex&);
  51.     friend istream& operator>>(istream&, complex&);
  52. };
Advertisement
Add Comment
Please, Sign In to add comment