Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

C++ operator classes

  1. Jun 30, 2009 #1
    i dont clearly understand that what are the real and imaginary numbers in c++ classes when defining operators. help me .
    thnx
     
    Last edited by a moderator: Jun 30, 2009
  2. jcsd
  3. Jun 30, 2009 #2

    Borek

    User Avatar

    Staff: Mentor

  4. Jun 30, 2009 #3
    << aggressive response deleted by berkeman >>
     
    Last edited by a moderator: Jun 30, 2009
  5. Jun 30, 2009 #4

    Borek

    User Avatar

    Staff: Mentor

    Yes, this is a math question. Real and imaginary numbers are not part of C++, classes and operators are.
     
  6. Jun 30, 2009 #5
    its true its math problem but in programming it is related now i wanna know what are the real n imaginary numbers.
    if i say c=a+d
    then a is real n d is imaginary number what does it mean................
    thnx if u will tell
     
  7. Jun 30, 2009 #6

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    The new c++ TR1 standard and the proposed C++0x have complex number classes, you should check if your compiler supports them.

    edit: in your example c would be a complex number, it's normally written c = a +id
     
  8. Jun 30, 2009 #7

    Borek

    User Avatar

    Staff: Mentor

    I have posted link to an explanation.
     
  9. Jun 30, 2009 #8
    what a lovely answer it is.........
    but its true that its not helpful for me.
    thnx 4 ur reply..
    i take my question back no can answer..............
     
  10. Jun 30, 2009 #9

    Dale

    Staff: Mentor

    As mgb_phys posted a complex number is a number of the form c = a + id. As the link that Borek posted indicates in the a+di form a and d are real numbers and i is the imaginary number (the square root of -1). Here a is called the real part of c and d is called the imaginary part of c.

    Complex numbers are important for many mathematical functions such as solving roots of polynomials, transcendental functions, etc. They can be easily represented programmatically as a named pair of floating point numbers representing the real part and the imaginary part, so they form a kind of prototypical example of a structured data type.

    Your reply to Borek was not very polite. He correctly identified your question and pointed you to a good site to fully answer it. He did not deserve to be replied to in that fashion.
     
  11. Jun 30, 2009 #10
    soorrry Borek
    now i understand the answer thnx actually i was in tention so sorry 4 that attitude
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: C++ operator classes
  1. Ternary operator in C (Replies: 13)

Loading...