/**************************************************************** **** **** This file belongs with the course **** Introduction to Scientific Programming in C++/Fortran2003 **** copyright 2017/8 Victor Eijkhout eijkhout@tacc.utexas.edu **** **** stream.cxx : simulate an integer stream **** ****************************************************************/ #include using std::cout; //codesnippet integerstream class Stream { private: int last_result{0}; public: int next() { return last_result++; }; }; int main() { Stream ints; cout << "Next: " << ints.next() << '\n'; cout << "Next: " << ints.next() << '\n'; cout << "Next: " << ints.next() << '\n'; //codesnippet end return 0; }