PROGRAMMING:Complex multiplication -- operator overloading
Establish a complex class, in which real and imaginary numbers are private data members;
The nonparametric and parameterized constructors of complex classes are established;
An operator overload of \ * (multiplication sign) is established to facilitate direct multiplication of two complex numbers;
The output function void display () is established to output the complex number;
The main function defines three complex objects C1, C2 and C3
Input format:
Input a total of one line, each line of two complex, respectively, for the complex class C1 and C2.
Output format:
After performing C3 = C1 \ * C2 operation, call the display function to output C3.
Tip: the input or output complex number may contain only real or imaginary parts.
Input example:
1+2i 2+3i
Output example:
-4+7i
answer:If there is no answer, please comment
The nonparametric and parameterized constructors of complex classes are established;
An operator overload of \ * (multiplication sign) is established to facilitate direct multiplication of two complex numbers;
The output function void display () is established to output the complex number;
The main function defines three complex objects C1, C2 and C3
Input format:
Input a total of one line, each line of two complex, respectively, for the complex class C1 and C2.
Output format:
After performing C3 = C1 \ * C2 operation, call the display function to output C3.
Tip: the input or output complex number may contain only real or imaginary parts.
Input example:
1+2i 2+3i
Output example:
-4+7i
answer:If there is no answer, please comment