write a program in c to add, subtract, multiply and divide two complex numbers?
z1 = a1+jb2
z2 = a2 +jb2
express the result in angular form?
xxxxxxxxxxxxxxxxxxxx
Printable View
write a program in c to add, subtract, multiply and divide two complex numbers?
z1 = a1+jb2
z2 = a2 +jb2
express the result in angular form?
xxxxxxxxxxxxxxxxxxxx
This sounds a lot like a homework problem (whether it originated from your "boyfriend" or your instructor). Please post the code you have to solve this problem so we can see what you understand and what you are missing.
Thanks.
i dont understand c at all!!
that was the question 4my assignment???
its in tomoz and im stuck?
pls help me
>i dont understand c at all!!
I guess then you don't know about structures. But it isn't too hard. A structure is a set of data. A structure can be defined this way:
A structure can be used as a datatype.Code:struct complex_number
{
int real;
int imaginary;
};
Here the variable complex is of type struct complex_number. This complex_number structure can be used as follows:Code:struct complex_number complex;
Now you have the complex number z=2+j3. I guess you now understand how you could use this in your calculations.Code:complex.real = 2;
complex.imaginary = 3;
Assume:
z = a + j b
p = m + jn
then
w = z + p =( a + m) + j (b + n)
This can be implemented as:
Hope this helps something.Code:struct complex_number z, p, w;
z.real = 2;
z.imaginary = 4;
p.real = 3;
p.imaginary = 6;
w.real = z.real + p.real;
w.imaginary = z.imaginary + p.imaginary;
I've got the answer for this in Java - I'll post it when I get home from work and can FTP into the school.