The <complex> header also includes the overload for extraction and insertion operations on input and output streams respectively.
The format in which they are formatted for output insertion is (real,imag), while for input extraction they may be formatted as a real, as a (real), or as (real,imag).
Parameters
- val
- Value representing a real numeric value without imaginary part.
T is the template parameter of class complex (i.e., its value type). - rhs
- Right-hand side object of a complex type.
- lhs
- Left-hand side object of a complex type (used in global functions).
- istr
- Input stream object where the value of a complex object is inserted (see istream).
- ostr
- Output stream object from where a complex value is extracted (see ostream).
Template parameters
- T
- The template type (the value type) of the first complex object.
- X
- The template type (the value type) of the second complex object.
- charT, traits
- The template types for the basic_istream or basic_ostream objects.
Return value
The left-hand side operand.Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
Output:
mycomplex is (20,1) |
See also
| complex | Complex number class (class template) |
