C++ Operator Classes: Real & Imaginary Numbers Explained

  • Context: C/C++ 
  • Thread starter Thread starter asma_MIT
  • Start date Start date
  • Tags Tags
    C++ Classes Operator
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
9 replies · 2K views
asma_MIT
Messages
6
Reaction score
0
i don't clearly understand that what are the real and imaginary numbers in c++ classes when defining operators. help me .
thnx
 
Last edited by a moderator:
Physics news on Phys.org
<< aggressive response deleted by berkeman >>
 
Last edited by a moderator:
Yes, this is a math question. Real and imaginary numbers are not part of C++, classes and operators are.
 
its true its math problem but in programming it is related now i want to 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
 
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
 
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.....
 
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.
 
soorrry Borek
now i understand the answer thnx actually i was in tention so sorry 4 that attitude