fork(5) download
  1. #include <iostream>
  2.  
  3. typedef std::ostream& (*manip) (std::ostream&);
  4.  
  5. class console {
  6.  
  7. };
  8.  
  9. template <class T> console& operator<< (console& con, const T& x) { std::cout << x; return con; }
  10. template <class T> console& operator>>(console& con, T& x) { std::cin >>x; return con; }
  11. console& operator<< (console& con, manip manipulator){ std::cout<<manipulator; return con;}
  12.  
  13. int main() {
  14. console c;
  15. int a,b;
  16. c>>a>>b;
  17. c << "hello world"<<std::endl<<std::hex<<(a+b)<<std::endl;
  18. }
Success #stdin #stdout 0.01s 2684KB
stdin
10
6
stdout
hello world
10