A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.com/reference/complex/complex/real/ below:

public member function

<complex>

std::complex::real get (1)
T real() const;
set (2)
void real (T val);

Real part

Returns the real part of the complex number.

Returns the real part of the complex number (1), or sets val as the new value for the real part (2).


A non-member function exists with the same name: real.

Parameters none

Return value The real part.
T is complex's template parameter.

Example
1
2
3
4
5
6
7
8
9
10
11
12
// complex::real example
#include <iostream>     // std::cout
#include <complex>      // std::complex

int main ()
{
  std::complex<double> mycomplex (10.0,1.0);

  std::cout << "Real part: " << mycomplex.real() << '\n';

  return 0;
}

Output:


See also
complex::imag
Imaginary part (public member function)
real
Real part of complex (function template)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4