(Complex Class) Consider class Complex shown in Figs. The class enables operations on so-called complex numbers. These are numbers of the form real Part + imaginaryPart * i, where i has the value
![]()
a) Modify the class to enable input and output of complex numbers via overloaded ≫ and ≪ operators, respectively (you should remove the print function from the class).
b) Overload the multiplication operator to enable multiplication of two complex numbers as in algebra.
c) Overload the == and != operators to allow comparisons of complex numbers.
After doing this exercise, you might want to read about the Standard Library's complex class (from header
).

Fig. Complex class definition.

Fig. Complex class member-function definitions.


Fig. Complex class test program.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.