#include "complex.h"

// Friend function to print out a complex number: "(r, i)" or just "r" if
// imaginary component is zero.
std::ostream & operator<<(std::ostream & o, const complex & c)
{
  if (c.imag == 0)
    std::cout << c.real;
  else
    std::cout << "(" << c.real << ", " << c.imag << ")";

  return o;
}
