home *** CD-ROM | disk | FTP | other *** search
- // tstack2.h
- #include <iostream.h>
- #include "stack2.h"
-
- main()
- {
- Stack<int> s1(5), s2(5);
-
- // Push odds onto s1, evens onto s2:
- for (int i = 1; i < 10; i += 2)
- {
- s1.push(i);
- s2.push(i+1);
- }
-
- // Retrieve and print in LIFO order:
- cout << "Stack 1:\n";
- while (!s1.empty())
- cout << s1.pop() << endl;
-
- cout << "Stack 2:\n";
- while (!s2.empty())
- cout << s2.pop() << endl;
-
- return 0;
- }
-
- /* Output:
- Stack 1:
- 9
- 7
- 5
- 3
- 1
- Stack 2:
- 10
- 8
- 6
- 4
- 2
- */
-
- /* End of File */
-
-