# Include <iostream. h>
Class complex // define a complex class
{
PRIVATE:
Double real; // real
Double imag; // virtual part
Public:
Complex () {}// define the constructor
Complex (Double R, double I) // overload Constructor
{
Real = R;
Imag = I;
}
Void display ()
{
Cout <"(" <real <"," <imag <")" <Endl;
}
Complex operator + (complex I2) // overload addition Operators
{
Complex;
A. Real = This-> real + i2.real;
A. imag = This-> imag + i2.imag;
Return;
}
Complex operator-(complex I2) // overload subtraction Operator
{
Complex B;
B. Real = This-> real-i2.real;
B. imag = This-> imag-i2.imag;
Return B;
}
Complex operator * (complex I2) // overload multiplication Operator
{
Complex C;
C. Real = This-> real * i2.real;
C. imag = This-> imag * i2.imag;
Return C;
}
Complex operator/(complex I2) // overload division Operator
{
Complex D;
D. Real = This-> real/i2.real;
D. imag = This-> imag/i2.imag;
Return D;
}
};
Void main ()
{
Int X1, Y1, X2, Y2;
Cin> x1> Y1> X2> Y2;
Complex A, B, C, D, I1 (x1, Y1), I2 (X2, Y2 );
A = I1 + I2; // calculate the sum of C1, C2 and
B = i1-i2; // evaluate the difference between C1 and C2 using the operator after overloading
C = I1 * I2; // calculate the product of C1 and C2 using the overloaded Operator
D = I1/I2; // calculate division of C1 and C2 using the overloaded Operator
Cout <"I1 ="; i1.display ();
Cout <"I2 ="; i2.display ();
Cout <"I1 + I2 ="; A. Display ();
Cout <"i1-i2 ="; B. Display ();
Cout <"I1 * I2 ="; C. Display ();
Cout <"I1/I2 ="; D. Display ();
}