Commit 5c4606de by Patryk Czarnik

operacja wypisywania

parent 88f2cbc7
...@@ -40,3 +40,14 @@ void Wektor::set(int idx, int e) { ...@@ -40,3 +40,14 @@ void Wektor::set(int idx, int e) {
int Wektor::get(int idx) { int Wektor::get(int idx) {
return t[idx]; return t[idx];
} }
std::ostream& operator<<(std::ostream& out, const Wektor& w) {
out << '[';
for(int i=0; i<w.liczba_elementow; i++) {
out << w.t[i] << ", ";
}
out << ']';
return out;
}
...@@ -29,6 +29,7 @@ public: ...@@ -29,6 +29,7 @@ public:
/** Odczyt wartości spod podanej pozycji. */ /** Odczyt wartości spod podanej pozycji. */
int get(int idx); int get(int idx);
friend std::ostream& operator<<(std::ostream&, const Wektor&);
}; };
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment