Question: C++ exercise 3. Complex Numbers. Implement a C++ class Complex to store complex numbers. A complex number is a number that is formed of a

C++ exercise  C++ exercise 3. Complex Numbers. Implement a C++ class "Complex" to
store complex numbers. A complex number is a number that is formed

3. Complex Numbers. Implement a C++ class "Complex" to store complex numbers. A complex number is a number that is formed of a real and of an imaginary part. It can be expressed as: a + bi where a is the real number, and b is the imaginary unit. For example: 2 3i. More precisely, your class should contain: 1. Data members: double real double imaginary. 2. A constructor that takes the real and imaginary parts. 3. A default constructor that initializes both data items to 0 Then you need to implement the following: 1. Overload the output operator () to take a complex number as input as follows: real + imaginary i (or real - imaginary i). 3. Overload the corresponding operator, to allow the addition of two complex numbers. To add two complex numbers, the real numbers will be added together and the imaginary ones will be added together. For example: C1 12 34i C2 10+40i C3 C1 C2 226i 6. In the main function: (a) Take two complex numbers as input from the user. (b) Display the two numbers C1 and C2 (using cout

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!