i need help in to write the class definition for class called complex.\complex numbers have the form

realPart + imaginaryPart *i

where I is the square of (-1)

use double variable to represent the private data of the class. Provide a constructor that enables an object of the class to be initialized when it is declared. The constructor should contain default values of 0 in case no initializer are provided. Provide public member functions that perform the following tasks:

a) setComplex function to set complex number to set the real part and imaginary part of the complex number

b) displayComplex function to print complex number in the form (a,b), where a is the real part and b is the imaginary part.

I try and something I'm not doing right.

realPart + imaginaryPart *i

where I is the square of (-1)

use double variable to represent the private data of the class. Provide a constructor that enables an object of the class to be initialized when it is declared. The constructor should contain default values of 0 in case no initializer are provided. Provide public member functions that perform the following tasks:

a) setComplex function to set complex number to set the real part and imaginary part of the complex number

b) displayComplex function to print complex number in the form (a,b), where a is the real part and b is the imaginary part.

I try and something I'm not doing right.

What have you tried so far? We could easily give you the answer in < 2 min but we'd rather help you to derive it yourself. If you don't try and get this, you'll run into much more difficult problems in the future for which you will not have the basic understanding required to tackle the problem.

Topic archived. No new replies allowed.