Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // header 11-1
- #ifndef VECTOR0_H_
- #define VECTOR0_H_
- #include <iostream>
- namespace VECTOR
- {
- class vector
- {
- public:
- enum Mode{RECT, POL};
- private:
- double x;
- double y;
- double len;
- double ang;
- Mode mode;
- void set_len();
- void set_ang();
- void set_x();
- void set_y();
- public:
- vector();
- vector(double n1, double n2, Mode form = RECT);
- void reset(double n1, double n2, Mode form = RECT);
- ~vector();
- double xval() const { return x; }
- double yval() const { return y; }
- double lenval() const { return len; }
- double angval() const { return ang; }
- void polar_mode();
- void rect_mode();
- vector operator+(const vector & b) const;
- vector operator-(const vector & b) const;
- vector operator-() const;
- vector operator*(double n) const;
- friend vector operator*(double n, const vector & a);
- friend std::ostream & operator<<(std::ostream & os, const vector & v);
- };
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement