Does c++ hold complex numbers... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Does c++ hold complex numbers...

10th Jul 2019, 7:31 AM
Muaaz Ahmed
Muaaz Ahmed - avatar
5 Answers
+ 5
gotta create a class and overload operators for that
12th Jul 2019, 1:20 AM
Aditya
Aditya - avatar
+ 3
Yes it does, though not really directly. It has a library for that in the <complex> header. You can refer to http://www.cplusplus.com/reference/complex/
10th Jul 2019, 7:37 AM
Agent_I
Agent_I - avatar
+ 3
Yes Thecomplex library implements thecomplex class to contain complex numbers in cartesian form and several functions and overloads to operate with them. real() – It returns the real part of the complex number. imag() – It returns the imaginary part of thecomplex number. Src= Google
11th Jul 2019, 8:32 PM
Akubia Godwin Maxwell
Akubia Godwin Maxwell - avatar
+ 2
Not in a primitive built in data type.
11th Jul 2019, 4:23 AM
Sonic
Sonic - avatar
+ 2
yes c++ holds complex number. In complex class variables to represent the real and imaginary portions of a complex number. Your Complex class should have at least the following member functions publicly available: Complex()    Constructor: takes a real and an imaginary floating point value. Both values should be defaulted to 0.0. real() Returns the floating-point real number portion of the complex number. imaginary() Returns the floating-point imaginary portion of the thanks complex number. for more info on operators on complex number :- https://www.chegg.com/homework-help/questions-and-answers/c-programming-implement-class-called-complex-used-represent-complex-numbers-complex-number-q7925825
12th Jul 2019, 12:53 AM
THRISHUL M P
THRISHUL M P - avatar