fork(1) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class mendl
  6. {
  7. public:
  8. explicit mendl(unsigned int i) : n(i) {}
  9. private:
  10. unsigned int n;
  11.  
  12. template <class charT, class Traits>
  13. friend basic_ostream<charT,Traits>& operator<< (basic_ostream<charT,Traits>& os, const mendl& w)
  14. {
  15. // the manipulation: insert end-of-line characters and flush
  16. for (int i=0; i<w.n; i++)
  17. os << '\n';
  18. os.flush();
  19. return os;
  20. }
  21. };
  22.  
  23.  
  24. int main()
  25. {
  26. cout << "ere" << mendl(5) << "dfd";
  27. return 0;
  28. }
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
ere




dfd