Witam, mam do napisania kalkulator macierzy zespolonych jednak kompletnie nie wiem jak się poslugiwac <vector>. Nie wiem jak przeciazyc argumenty w klasie Matrix +,-,* wszelka pomoc, wskazowki mile widziane
#include <iostream>
using namespace std;
class Complex
{
public:
double re,im;
Complex(double re, double im);
Complex operator+(const Complex &c);
{
Complex comp;
comp.re= this->re + c.re;
comp.im = this->im + c.im;
return comp;
}
Complex operator-(const Complex &c);
{
Complex comp;
comp.re = this->re - c.re;
comp.im = this->im - c.im;
return comp;
}
Complex operator*(const Complex &c);
{
Complex comp;
comp.re=(re*c.re)-(im*c.im);
comp.im=(re*c.im)+(im*c.re);
return comp;
}
friend ostream & operator<<(const ostream &os, const Complex &c);
};
class Matrix
{
public:
vector< vector<Complex> > element;
Matrix(Complex &c, int row, int col);
Matrix operator+(const Matrix &m);
Matrix operator-(const Matrix &m);
Matrix operator*(const Matrix &m);
friend ostream & operator<<(const ostream &os, const Matrix &m);
};
//---------------------------------------------------------------------------------------------------------------------
ostream & operator<<(ostream &os, const Complex &c) {
os << c.re << "," << c.im << "i";
return os;
};
ostream & operator<<(ostream &os, const Matrix &m) {
for(int i=0;i<m.element.size();i++) {
for(int j=0;j<m.element.at(0).size();j++)
os << m.element.at(i).at(j) << " ";
os << endl;
}
return os;
};