Question: Problem Description: Declare and define a class for a complex number. A complex number in mathematics is defined as x+yi , where x defines the
Problem Description:
Declare and define a class for a complex number. A complex number in mathematics is defined as x+yi , where x defines the real part of the number and y is the imaginary part.
Requirements (Program to be written in C++):
Define a complex class that has the following member functions:
o constructor that initializes the complex number by default arguments
o set function that sets the real part of the complex number
o set function that sets the imaginary part of the complex number
o get function that returns the real part of the complex number
o get function that returns the imaginary part of the complex number
o a function that displays the complex number
Add the following nonmember functions in your complex header file and implementation file :
o A function that returns the sum of two complex numbers
o A function that returns the difference of two complex numbers
o A function that returns the product of two complex numbers
o A function that returns the quotient of two complex numbe
Write the class in header and implementation files , and compile it separately from the client program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
