Thread: OR THis 1

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    5

    Talking 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. #2
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    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.
    Jason Deckard

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    5

    ????????????????

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

  4. #4
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    >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. #5
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    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 subscribe to a feed