#include #include //for ofstream #include #include //for ostream_iterator using namespace std; int main() { ostream_iterator it(cout, " bottles of beer on the wall\n"); *it = 100; ++it; *it = 99; ++it; *it = 98; ++it; //--it; //won't compile: this class has no operator-- function //int i = *it; //won't compile: an ostream_iterator is not an input iterator ofstream of("outfile"); ostream_iterator os(of, "\n"); *os = 100; ++os; *os = 99; ++os; *os = 98; ++os; return EXIT_SUCCESS; }