Javkens

Untitled

Jan 16th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. //complex0.h
  2. void set_real() {std::cin >> real;}
  3. void set_imag() {std::cin >> imag;}
  4. friend std::ostream & operator<<(std::ostream & os, const Complex0 & c);
  5. friend std::iostream & operator>>(std::iostream & os, Complex0 & c);
  6.  
  7. //complex0.cpp
  8. std::ostream & operator<<(std::ostream & os, const Complex0 & c)
  9. {
  10.     os << "(" << c.real <<  ", " << c.imag << "i)";
  11.     return os;
  12. }
  13.  
  14. std::iostream & operator<<(std::iostream & os, Complex0 & c)
  15. {
  16.     os << "Podaj czesc rzeczywista: ";
  17.     c.set_real();
  18.     os << endl << "Podaj czesc urojona: ";
  19.     c.set_imag();
  20.     os << endl;
  21.     return os;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment