Advertisement
Leedwon

Untitled

Apr 21st, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. // header 11-1
  2.  
  3. #ifndef VECTOR0_H_
  4. #define VECTOR0_H_
  5. #include <iostream>
  6.  
  7. namespace VECTOR
  8. {
  9.     class vector
  10.     {
  11.     public:
  12.         enum Mode{RECT, POL};
  13.     private:
  14.         double x;
  15.         double y;
  16.         double len;
  17.         double ang;
  18.         Mode mode;
  19.         void set_len();
  20.         void set_ang();
  21.         void set_x();
  22.         void set_y();
  23.     public:
  24.         vector();
  25.         vector(double n1, double n2, Mode form = RECT);
  26.         void reset(double n1, double n2, Mode form = RECT);
  27.         ~vector();
  28.         double xval() const { return x; }
  29.         double yval() const { return y; }
  30.         double lenval() const { return len; }
  31.         double angval() const { return ang; }
  32.         void polar_mode();
  33.         void rect_mode();
  34.         vector operator+(const vector & b) const;
  35.         vector operator-(const vector & b) const;
  36.         vector operator-() const;
  37.         vector operator*(double n) const;
  38.         friend vector operator*(double n, const vector & a);
  39.         friend std::ostream & operator<<(std::ostream & os, const vector & v);
  40.     };
  41. }
  42. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement