diff --git a/.gitmodules b/.gitmodules
index 1c1a216..75c212a 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
[submodule "Catch"]
path = Catch
- url = https://github.com/philsquared/Catch.git
+ url = https://github.com/philsquared/Catch
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..e2e962e
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+vector
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..3eb495b
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..c284c49
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vector.iml b/.idea/vector.iml
new file mode 100644
index 0000000..2987155
--- /dev/null
+++ b/.idea/vector.iml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..a87191d
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,329 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1457946099530
+
+ 1457946099530
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Catch b/Catch
index 1531763..ae5ee2c 160000
--- a/Catch
+++ b/Catch
@@ -1 +1 @@
-Subproject commit 15317632f3caf59a3ba3da2ec3dc3ee189bbbc9a
+Subproject commit ae5ee2cf63d6d67bd1369b512d2a7b60b571c907
diff --git a/README.md b/README.md
index f536447..d9d581e 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,4 @@
# vector
Linear space element representation
+[](https://ci.appveyor.com/project/ElenaVinogradova/vector/branch/solomon)
+[](https://travis-ci.org/ElenaVinogradova/vector)
\ No newline at end of file
diff --git a/include/vector.h b/include/vector.h
index 222a4fe..9cab5a3 100644
--- a/include/vector.h
+++ b/include/vector.h
@@ -3,48 +3,49 @@
class Vector {
public:
- const static unsigned long n = 3;
+ const static unsigned long n = 3;
- Vector();
+ Vector();
- explicit Vector(double);
+ explicit Vector(double);
- Vector(const Vector &);
+ Vector(const Vector &);
- Vector &operator=(const Vector &);
+ Vector &operator=(const Vector &);
- double operator[](unsigned long i) const;
+ double operator[](unsigned long i) const;
- double &operator[](unsigned long i);
+ double &operator[](unsigned long i);
- Vector &operator+=(const Vector &);
+ Vector &operator+=(const Vector &);
- Vector &operator-=(const Vector &);
+ Vector &operator-=(const Vector &);
- Vector &operator*=(double);
+ Vector &operator*=(double);
- Vector &operator/=(double);
+ Vector &operator/=(double);
- friend bool operator==(const Vector &, const Vector &);
+ friend bool operator==(const Vector &, const Vector &);
- friend Vector operator+(const Vector &, const Vector &);
+ friend Vector operator+(const Vector &, const Vector &);
- friend Vector operator-(const Vector &, const Vector &);
+ friend Vector operator-(const Vector &, const Vector &);
- friend Vector operator*(const Vector &, double);
+ friend Vector operator*(const Vector &, double);
- friend Vector operator*(double, const Vector &);
+ friend Vector operator*(double, const Vector &);
- friend Vector operator/(const Vector &, double);
+ friend Vector operator/(const Vector &, double);
- friend double operator^(const Vector &, const Vector &);
+ friend double operator^(const Vector &, const Vector &);
- Vector operator-() const;
+ Vector operator-() const;
private:
- double coords_[n];
+ double coords_[n];
}; // class Vector
bool operator!=(const Vector &, const Vector &);
#endif // VECTOR_H
+
diff --git a/src/vector.cpp b/src/vector.cpp
new file mode 100644
index 0000000..61138e5
--- /dev/null
+++ b/src/vector.cpp
@@ -0,0 +1,107 @@
+#include "vector.h"
+
+Vector::Vector() {
+ for (unsigned int i = 0; i < n; ++i) {
+ coords_[i] = 0;
+ }
+}
+
+Vector::Vector(double a) {
+ for (unsigned int i = 0; i < n; ++i) {
+ coords_[i] = a;
+ }
+}
+
+Vector::Vector(const Vector &op) {
+ for (unsigned int i = 0; i < n; ++i) {
+ coords_[i] = op.coords_[i];
+ }
+}
+
+Vector &Vector::operator=(const Vector &op) {
+ for (unsigned int i = 0; i < n; ++i) {
+ coords_[i] = op.coords_[i];
+ }
+ return *this;
+}
+
+double Vector::operator[](unsigned long i) const {
+ return coords_[i];
+}
+
+double &Vector::operator[](unsigned long i) {
+ return coords_[i];
+}
+
+Vector &Vector::operator+=(const Vector &op) {
+ for (unsigned int i = 0; i < n; ++i) {
+ coords_[i] += op.coords_[i];
+ }
+ return *this;
+}
+
+
+Vector &Vector::operator-=(const Vector &op) {
+ for (unsigned int i = 0; i < n; ++i) {
+ coords_[i] -= op.coords_[i];
+ }
+ return *this;
+}
+
+Vector &Vector::operator*=(double a) {
+ for (unsigned int i = 0; i < n; ++i) {
+ coords_[i] *= a;
+ }
+ return *this;
+}
+
+Vector &Vector::operator/=(double a) {
+ for (unsigned int i = 0; i < n; ++i) {
+ coords_[i] /= a;
+ }
+ return *this;
+}
+
+bool operator==(const Vector &op1, const Vector &op2) {
+ for (unsigned int i = 0; i < Vector::n; i++) {
+ if (op1.coords_[i] != op2.coords_[i]) {
+ return false; }
+ }
+ return true;
+}
+
+Vector operator+(const Vector &op1, const Vector &op2) {
+ return Vector(op1)+=op2;
+}
+
+Vector operator-(const Vector &op1, const Vector &op2) {
+ return Vector(op1)-=op2;
+}
+
+Vector operator*(const Vector &op, double a) {
+ return Vector(op) *= a;
+}
+Vector operator*(double a, const Vector &op){
+ return Vector(op) *= a;
+}
+
+Vector operator/(const Vector &op1, double a) {
+ return Vector(op1) /= a;
+}
+
+double operator^(const Vector &op1, const Vector &op2) {
+ double res = 0;
+ for (unsigned int i = 0; i < Vector::n; ++i) {
+ res += op1.coords_[i] * op2.coords_[i];
+ }
+ return res;
+}
+
+Vector Vector::operator-() const {
+ return Vector(*this) *= -1;
+}
+
+bool operator!=(const Vector &op1, const Vector &op2) {
+ return !(op1 == op2);
+
+}