Загрузка данных


#include <iostream>
#include <math.h>;
using namespace std;

class Cmplx {
public:
    double re;
    double im;
    Cmplx(double a, double b) { re = a;  im = b; }
    Cmplx() { re = 0; im = 0; }
    Cmplx(Cmplx& mi) {
        re = mi.re;
        im = mi.im;
    }
    Cmplx& operator=(const Cmplx& other) {
        re = other.re;
        im = other.im;
        return*this;
    }
    Cmplx operator-(const Cmplx& other) {
        Cmplx result;
        result.re = re - other.re;
        result.im = im - other.im;
        return result;
    }
    Cmplx operator*(const Cmplx& other) {
        Cmplx result; 
        re = re * other.re - (im * other.im);
        im = re * other.im + im * other.re;
        return result;
    }
    Cmplx operator+(const Cmplx& other) {
        Cmplx result;
        result.re = re + other.re;
        result.im = im + other.im;
        return result;
    }
};

ostream& operator<< (ostream& strm, Cmplx& mli)
{
    return strm << '(' << mli.re << ',' << mli.im << ')';
}
int main() {
    Cmplx a(5, 3);
    Cmplx b(2, 6);
    Cmplx d;
    d = a + b;
    cout << d << endl;
    
}