/* TestQueue3.cpp CIS 250 March 24, 2008 This program tests the queued templated queue class. */ #include "queued.h" #include using std::cout; using std::endl; void display(queued); int main(void) { double i=0, n; queued q, q2; cout << "Filling queue with 0, 2.2, 4.4, ...\n"; while (i < 5) { if (!q.add(i*2.2)) cout << "Failed to add " << (i*2.2) << '\n'; else cout << "Added " << (i*2.2) << " to queue\n"; i++; } cout << "Displaying queue using function\n"; display(q); q2 = q; cout << "Displaying queue\n"; while (!q.isEmpty()) { q.remove(n); cout << n << '\n'; } cout << "Displaying queue again\n"; while (!q.isEmpty()) { q.remove(n); cout << n << '\n'; } cout << "Displaying queue #2\n"; while (!q2.isEmpty()) { q2.remove(n); cout << n << '\n'; } return 0; } void display(queued q) { double n; while (!q.isEmpty()) { q.remove(n); cout << n << '\n'; } }