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