• Source
    1. #include <iostream>
    2. #include<complex>
    3.  
    4. namespace std
    5. {
    6. template <typename charT, typename traits>
    7. std::basic_ostream<charT, traits> &operator <<
    8. (std::basic_ostream<charT, traits> &strm, const std::complex<double>& c)
    9. {
    10. strm<<c.real()<<"+"<<c.imag()<<"*i"<<std::endl;
    11. return strm;
    12. }
    13. }
    14.  
    15. int main() {
    16. // your code goes here
    17. std::cout<<std::complex<double>(1.0,1.0);
    18. return 0;
    19. }