Question: A. Modify the above program so that the addition of two complex numbers will be done in a function instead of doing it in the


A. Modify the above program so that the addition of two complex numbers will be done in a function instead of doing it in the main function. Bellow the function frame: struct complex add(struct complex z1, struct complex 22) { struct sum; 1/Add your code here return sum; } B. Modify your code by adding separate functions to compute the difference between the two complex numbers, the product of the two complex numbers, and the result of dividing the first complex number by the second complex number. Hint: consider the two complex numbers The difference between the two numbers is (real1 - real2) + (imag1 - imag2) The product of the two numbers is (real1*real2 -imag1*imag2 ) + (real1*imag2+ real2*imag1) i The division of the first complex number by the second complex number is given by: real1 * real2 + imag1 * imag2 /real2 * imag1 real1 * imag2 + real22 + imag22 real22 + imag22 i The program below use the above mentioned complex number definition and asks the user to enter two complex numbers, adds the two numbers, and displays the sum. #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
