diff --git a/vector.hpp b/vector.hpp index d4c4e5a..d557b23 100644 --- a/vector.hpp +++ b/vector.hpp @@ -8,6 +8,7 @@ private: uint64_t dimention = 0; cnumber *entries = NULL; bool err = true; + bool row = false; public: bool is_error() { return this->err; } @@ -44,6 +45,8 @@ public: } return cnumber(0, 0); } + void make_row() { this->row = true; } + void make_column() { this->row = false; } void set_entry(const uint64_t index, const cnumber z) { if (index < this->get_dimention()) { this->entries[index] = z; @@ -60,18 +63,28 @@ public: friend std::ostream &operator<<(std::ostream &os, const vector &v) { int longest = 0; + if (v.row) { + os << '('; + for (uint64_t i = 0; i < v.get_dimention(); i++) { + os << v[i]; + if (i != v.get_dimention() - 1) + os << ','; + } + os << ')'; + return os; + } for (uint64_t i = 0; i < v.get_dimention(); i++) { - std::ostringstream oss; + std::ostringstream oss; oss << v[i]; std::string s = oss.str(); if (longest < s.length()) - longest = s.length(); + longest = s.length(); } for (uint64_t i = 0; i < v.get_dimention(); i++) { - std::ostringstream oss; + std::ostringstream oss; oss << v[i]; std::string s = oss.str(); - int padding = longest - s.length() +1; + int padding = longest - s.length() + 1; os << "|" << v[i] << std::setw(padding) << "|"; if (i != v.get_dimention() - 1) os << std::endl;