answersLogoWhite

0

The following are the different ways to assign a value to a complex number:

By passing two Double values to its constructor. The first value represents the real, and the second value represents imaginary part of a complex number.

For example,

Complex c1 = new Complex(5, 8); /* It represents (5, 8) */
By assigning a Byte, SByte, Intl6, UIntl6, Int32, UInt32, Int64, UInt64, Single, or Double value to aComplex object. The assigned value represents the real part of the complex number, and its imaginary part becomes0. For example,
Complex c2 = 15.3; /* It represents (15.3, 0) */
By casting a Decimal or BigInteger value to a Complex object.
For example,
Complex c3 = (Complex) 14.7; /* It represents (14.7, 0) */
Assigning the value returned by an operator to a Complex variable.
For example,
Complex c4 = c1 + c2; /* It represents (20.3, 8) */
User Avatar

Wiki User

8y ago

Still curious? Ask our experts.

Chat with our AI personalities

JudyJudy
Simplicity is my specialty.
Chat with Judy
FranFran
I've made my fair share of mistakes, and if I can help you avoid a few, I'd sure like to try.
Chat with Fran
ProfessorProfessor
I will give you the most educated answer.
Chat with Professor

Add your answer:

Earn +20 pts
Q: How do you instantiate a complex number?
Write your answer...
Submit
Still have questions?
magnify glass
imp