C++/Console/ostream iterator

Материал из C\C++ эксперт
Перейти к: навигация, поиск

Override ostream

  
#include <iostream>
using namespace std;
ostream& attention(ostream& cout) {
 return(cout << "\a");
};
int main(void){
   cout << attention << "The boss is coming to your office...\n";
}


Write Output sing an ostream iterator

 

#include <iostream>
#include <iterator>
using namespace std;
int main()
{
    ostream_iterator<int, char>    oi(cout);
    *oi = 6;
    *++oi = 88;
    return 0;
}