Question: Edit, compile, and run the following program: Create a class called Complex for performing arithmetic with complex numbers.Complex numbers have the form a + bi

Edit, compile, and run the following program:
Create a class calledComplexfor performing arithmetic with complex numbers.Complex numbers have the forma + bi, whereais the real part,bis the imaginary part, andiis the square root of negative one.The data members,realandimaginary, should be data typedouble.In the constructor, initializerealandimaginaryto zero (0).Write oneprint()function that outputs the complex number in the format:a + biWrite oneset()method that sets bothrealandimaginary.Write twoget()methods (getReal()andgetImaginary()) that return the valuesrealorimaginary.In the driver program (main() function), create at least three (3) complex numbers and test all of the member functions for classComplex.

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 Programming Questions!