#include #include #include using namespace std; #ifndef _VECTOR_HPP_ #define _VECTOR_HPP_ class Vector { int *array; int size; public: Vector(int length=0); Vector(const Vector& v); Vector(const Vector *v); ~Vector(); int length() const; // return Vector's length. int &valueAt(int pos) const; // return a reference to element at position pos int find(int a) const; // check if a exists in Vector. Return it position >0 or -1 // if not element not found void print() const; // print vector values to standard output void print(string &msg) const; // print vector values to standard output /* binary operators that don't modify left operand */ Vector& operator=(const Vector& v); // assignment operator Vector operator+(const Vector& v) const; // Adds v to *this and returns the sum in a new vector. //friend Vector operator+(const Vector& v1, const Vector& v2); // same as above Vector operator-(const Vector& v) const; // Subtracts v from *this and returns the subtraction in a new vector. Vector operator*(const Vector& v) const; // Returns a new vector that is the product of v and *this. friend Vector operator+(const Vector& v, int a); // Returns a new vector. Each element of vector equals the sum of v[i] + a friend Vector operator+(int a, const Vector& v); // Returns a new vector. Each element of vector equals the sum of v[i] + a Vector operator-(int a) const; // Returns a new vector. Each element of vector equals the subtraction: v[i] - a Vector operator*(int a) const; // Returns a new vector. Each element of vector equals the product: v[i] * a friend Vector operator*(int a, const Vector& v); // Returns a new vector. Each element of vector equals the product: v[i] * a Vector operator/(int a) const; // Returns a new vector. Each element of vector equals the division (int): v[i] / a Vector operator%(int a) const; // Returns a new vector. Each element of vector equals the modulo: v[i] % a bool operator==(const Vector& v) const; // Returns true if each element of the left operand equals each element of right operand. bool operator!=(const Vector& v) const; // Returns true if each element of the left operand is NOT equal with each element // of right operand. Vector operator << (int a) const; // Returns a new vector. Each element of vector is left shifted by a positions. //friend Vector operator<<(const Vector& v, int a);// Same as above Vector operator >> (int a) const; // Returns a new vector. Each element of vector is right shifted by a positions. //friend Vector operator>>(const Vector& v, int a);// Same as above }; #endif