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 typedoubleIn the constructor, initializerealandimaginaryto zero Write oneprintfunction that outputs the complex number in the format:a biWrite onesetmethod that sets bothrealandimaginaryWrite twogetmethods getRealandgetImaginary that return the valuesrealorimaginaryIn the driver program main function create at least three 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
