setX

constexpr void setX(const double x) noexcept

Sets the real component x.

Parameters

const double x

A real number.

Sets the real component of the complex object.

Example

Complex z;
z.setX(1);
std::cout << z << "\n";

Output:

1 + 0j