# Thread: OR THis 1

1. ## OR THis 1

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

2. 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.

3. ## ????????????????

i dont understand c at all!!
that was the question 4my assignment???
its in tomoz and im stuck?
pls help me

4. >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:

Code:
```struct complex_number
{
int real;
int imaginary;
};```
A structure can be used as a datatype.

Code:
`struct complex_number complex;`
Here the variable complex is of type struct complex_number. This complex_number structure can be used as follows:

Code:
```complex.real = 2;
complex.imaginary = 3;```
Now you have the complex number z=2+j3. I guess you now understand how you could use this in your calculations.

Assume:

z = a + j b
p = m + jn

then

w = z + p =( a + m) + j (b + n)

This can be implemented as:

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;```
Hope this helps something.

5. 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.

Popular pages Recent additions