public member function
<complex>
Return real part
Returns the
real part of the complex number.
A global function exists,
real, with the same behavior.
Parameters
none
Return value
Real part.
T is
complex's template type.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13
|
// complex::real example
#include <iostream>
#include <complex>
using namespace std;
int main ()
{
complex<double> mycomplex (10.0,1.0);
cout << "Real part: " << mycomplex.real() << endl;
return 0;
}
|
Output:
See also
- complex::imag
- Return imaginary part (public member function)
- real
- Return real part of complex (function template)