///////////////////////////////////////////////////////////////////// // circularBuffer.cpp - declares buffer holding last n insertions // // Exam2:Q10 // // Jim Fawcett, CSE687 - Object Oriented Design, Spring 05 // ///////////////////////////////////////////////////////////////////// #include #include "circularBuffer.h" void main() { std::cout << "\n Elements of CircularBuffer from latest to earliest" << "\n ====================================================\n"; // create circular buffer for integers of length 10 std::cout << "\n "; CircularBuffer int_cb(10); // insert 20 integers in ascending order for(int i=0; i<20; ++i) int_cb.insert(i); // display contents = last 10 inserts // Note: iterator starts with most recent // and works backward in time CircularBuffer::iterator it; for(it=int_cb.begin(); it!=int_cb.end(); ++it) std::cout << *it << " "; std:cout << "\n\n"; }