C++/Console/ostream iterator — различия между версиями

Материал из C\C++ эксперт
Перейти к: навигация, поиск
м (1 версия: Импорт контента...)
 
(нет различий)

Версия 17:21, 25 мая 2010

Override ostream

<source lang="cpp">

  1. 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";

}


 </source>


Write Output sing an ostream iterator

<source lang="cpp">

  1. include <iostream>
  2. include <iterator>

using namespace std; int main() {

   ostream_iterator<int, char>    oi(cout);
   *oi = 6;
   *++oi = 88;
   return 0;

}


 </source>