Code /* TestStack3.cpp CIS 250 Dave Klick Test program for a templated stack class with dynamic memory allocation. */ #include "stackd.h" #include using std::cout; using std::endl; void display(stackd); int main(void) { double i=0, n; stackd s, s2; cout << "Filling stack with 0, 2.2, 4.4, ...\n"; while (i < 5) { if (!s.push(i*2.2)) cout << "Failed to push " << (i*2.2) << '\n'; else cout << "Pushed " << (i*2.2) << " onto stack\n"; i++; } cout << "Displaying stack using function\n"; display(s); s2 = s; cout << "Displaying stack\n"; while (!s.isEmpty()) { s.pop(n); cout << n << '\n'; } cout << "Displaying stack again\n"; while (!s.isEmpty()) { s.pop(n); cout << n << '\n'; } cout << "Displaying stack #2\n"; while (!s2.isEmpty()) { s2.pop(n); cout << n << '\n'; } return 0; } void display(stackd stk) { double n; while (!stk.isEmpty()) { stk.pop(n); cout << n << '\n'; } }