Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. ostream& operator<<(ostream& os, const Complex& c)  
  2. {  
  3.     if  (c.re!=0) {
  4.         if (abs(c.re)>1e-5) os<<c.re;
  5.         else os<<"0";
  6.     }
  7.     if (abs(c.im)>1e-5) {
  8.         os<<((c.im>0)?"+":"-");
  9.         if (abs(c.im)!=1) os<<abs(c.im);
  10.         os<<"i";
  11.     }
  12.     return os;  
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement