#include #include #include using namespace std; #ifndef _VECTOR_HPP_ #define _VECTOR_HPP_ class Vector { int *array; int size; public: Vector(unsigned int length=0); Vector(const Vector &v); Vector(const Vector *v); ~Vector(); unsigned int length() const; // return Vector's length. int& valueAt(unsigned int pos); // return a reference to element at position pos int find(int a) const; // check if 'a' exists in Vector. Return the position // If found, return the position of the element. // Otherwise, return -1 void print() const; // print to standard output vector values void print(string &msg) const; // print to standard output msg and vector values Vector& operator=(const Vector &v); int operator+() const; // returns the sum of Vector elements friend int operator*(const Vector&) ; // returns the product of Vector elements Vector operator-() const; // returns a new Vector, containing the negative // values of the original vector. Vector& operator++(); // prefix increment. Returns reference to the existing vector. friend Vector& operator--(Vector&); // prefix decrement. Returns reference to the existing vector. Vector operator++(int ); // postfix increment. Returns a new Vector. friend Vector operator--(Vector&, int); // postfix decrement. Returns a new Vector. Vector operator~() const; // returns the binary NOT for each element in a new Vector friend Vector operator!(const Vector &v); // returns a copy of the Vector with // elements in inverted sequence. }; #endif