#include using namespace std; class Complex { private: int r, i; public: Complex() = default; Complex(int); Complex(int, int); Complex operator+(Complex); void display(); }; Complex::Complex(int a) { this->r = this->i = a; } Complex::Complex(int r, int i) { this->r = r; this->i = i; } Complex Complex::operator+(Complex op) { return Complex(this->r + op.r, this->i + op.i); } void Complex::display() { if (this->r) cout << this->r; if (this-> r && this->i > 0) cout << '+'; if (this->i) cout << this->i << 'i'; cout << endl; } int main() { Complex c; Complex a(4), b(34, -2124); c = a + b; c.display(); }