Question: Complex Number Class (Operator Overloading) Define a class for complex numbers. A complex number is a number of the form a bi where for our


Complex Number Class (Operator Overloading) Define a class for complex numbers. A complex number is a number of the form a bi where for our purposes, a and b are numbers of type double, and is a number that represents the quantity 1. Represent a complex number as two values of type double. Name the member variables r and i. (The variable for the number that is multiplied by i is the one called imaginary.) Call the class Complex. Include a constructor with two parameters of type double that can be used to set the member variables of an object to any values. Include a constructor that has only a single parameter of type double; call this parameter realPart and define the constructor so that the object will be initialized to realPart0.Include a default constructor that initializes an object to 0 (that is, to 0+0*). Overload all the following operators so that they correctly apply to the type Complex:- , * , i, >> , and
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
