|
|
|
@ -160,12 +160,27 @@ public:
|
|
|
|
|
}
|
|
|
|
|
friend ostream &operator<<(ostream &os, const matrix &m) {
|
|
|
|
|
char last = '\0';
|
|
|
|
|
int longest = 0;
|
|
|
|
|
for (long long i = 0; i < m.num_entries; i++) {
|
|
|
|
|
for (long long j = 0; j < m.entry_dimension; j++) {
|
|
|
|
|
ostringstream oss;
|
|
|
|
|
oss << m.entries[i][j];
|
|
|
|
|
string s = oss.str();
|
|
|
|
|
if (longest < s.length())
|
|
|
|
|
longest = s.length();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (long long i = 0; i < m.num_entries; i++) {
|
|
|
|
|
for (long long j = 0; j < m.entry_dimension; j++) {
|
|
|
|
|
ostringstream iss;
|
|
|
|
|
iss << m.entries[i][j];
|
|
|
|
|
string s = iss.str();
|
|
|
|
|
int padding = longest - s.length() +1;
|
|
|
|
|
string symbols[3];
|
|
|
|
|
symbols[0] = "|";
|
|
|
|
|
ostringstream oss;
|
|
|
|
|
oss << " " << m.entries[i][j] << " ";
|
|
|
|
|
oss << m.entries[i][j] ;
|
|
|
|
|
oss << std::setw(padding) << "|";
|
|
|
|
|
symbols[1] = oss.str();
|
|
|
|
|
symbols[2] = "|";
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|