fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class A
  5. {
  6. int a, b, c, d;
  7. public:
  8.  
  9. friend istream& operator>>(istream&, A&);
  10. friend ostream& operator<<(ostream&, const A&);
  11.  
  12. };
  13.  
  14. istream& operator>>(istream& i, A& a)
  15. {
  16. return i >> a.a >> a.b >> a.c >> a.d;
  17. }
  18.  
  19. ostream& operator<<(ostream& o, const A& a)
  20. {
  21. return o << a.a << endl << a.b << endl << a.c << endl << a.d << endl;
  22. }
  23.  
  24. int main()
  25. {
  26. A a;
  27. cin >> a;
  28. cout << a;
  29. return 0;
  30. }
Success #stdin #stdout 0s 2900KB
stdin
1 2 3 4
stdout
1
2
3
4