Question: Language is C++ Define a structure Complex, it has two attributes: real, imag (both double type). You have to define functions to add, subtract, and

 Language is C++ Define a structure Complex, it has two attributes:

Language is C++

Define a structure Complex, it has two attributes: real, imag (both double type). You have to define functions to add, subtract, and multiply two complex numbers. Since complex numbers can be added/multiplied/subtracted with a real number as well, so the add, subtract and multiply functions should be overloaded: one where both operands are Complex numbers, other where first operand is complex and second operand is real. Main function is already given, you have to make it working. A function show will display the complex number is usual way i.e. x+yi Refer to this page for multiplication of complex numbers: https://www.mathsisfun.com/algebra/complex-number-multiply.html Details Sample Input For Custom Testing 25 5 3 10 Sample Output cl+c2: 7+81 cl-c2: -3+2i cl*c2: -5+317 cl+dl: 12+5 i cl-di: -8+51 cl*dl: 20+501 Explanation First input line is c1 = 2+5i, second line is C2 = 5+3i, third line is a real number d1 = 10. The result of addition/subtraction/multiplication are given as output

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!