Question

The lack of knowledge of complex numbers doesn't allow me to make the program. C++.

Task: Given real numbers u1, u2, v1, v2, w1, w2. Get 2u + (3uw)/(2+w-v) - 7, where u,v,w - complex numbers: u1+iu2, v1+iv2, w1+iw2. (Determine procedures for arithmetic operation's implementation on complex numbers).

Was it helpful?

Solution

You can implement this program through either classes or structures or any other way. Let us talk something about complex Number. Number of the form a+ib in which i^2 = -1. Note: a is a real part wher as b is an imaginary part. For example 4 + 5i where 4 is real and 5 is an imaginary part. Rule for addition is simple you add real part to the real part and imaginary part to the imaginary part.

  1. Addition (a+ib) + (c+id) = (a + c) + i( b + d )
  2. same rule for subtraction
  3. Multiplication (a + ib ) * (c + id) = ( ac - bd ) + i(ad + bc )

Ok now if you are using classes you can overload operator for addition, multiplication, division and subtraction. Now its upto you how you build your program.

You can also look at std::complex. Read also about this.

Thank You. If you have any questions please feel free to ask.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top