Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A complex number is a number that can be expressed in the form a + bi, where a and b are real numbers and i

A complex number is a number that can be expressed in the form a + bi, where a and b are real numbers and i is the imaginary unit, Squareroot -1 or i^2 = -1. In this expression, a is the real part and b is the imaginary part of the complex number. Give two complex numbers, a + bi and c + di, you can perform addition, subtraction, multiplication, and division using the following formulas: a + bi + c + di = (a + c) + (b + d)i Eq. 1 a + bi - (c + di) = (a - c) + (b - d)i Eq. 2 (a + bi) * (c + di) = (ac - bd) + (be + ad)i Eq. 3 (a + bi)/(c + di) = (ac + bd)/(c^2 + d^2) + (be - ad)i/(c^2 + d^2) Eq. 4 Write a program capable of performing complex arithmetic using equations 1 to 4. Your program should contain; Four functions: Given real numbers a, b, c, and d The add(a, b, c, d}function should output the sum of two complex numbers based on eq. 1. The sub(a, b, c, d)function should output the difference of two complex numbers based on eq. 2. The mult(a, b, c, d)function should output the product of two complex numbers based on eq. 3. The div(a, b, c, d)function should output the division of two complex numbers based on eq. 4. Main functions: In the main function, your program should prompt users for the two complex numbers (a, b, c, and d) and the mathematical operation they would like to perform and displays the result of the operation to the screen. In addition, your program should use a while or do...while statement to check whether the user would like to quit or continue performing further computation.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Students also viewed these Programming questions

Question

What is the role of reward and punishment in learning?

Answered: 1 week ago