------------------------------------------------------------------------------
MC logo
C++ Integer Stack Driver
[^] Code Examples
------------------------------------------------------------------------------
<<C++ Integer Stack Implementation istackuse2.cc PrintMe Class>>
#include <iostream>
#include "istack2.h"

using namespace std;

main()
{
        // Declare two stacks (not references)
        IntStack s, t;

        // Read in and stack some integers.
        int in;
        while(cin >> in) {
                s.push(in);
                t.push(2*in-5);
        }

        // Print out one of the stacks.
        cout << s << endl;

        // Empty the stack printing its members.
        while(! s.empty())
                cout << "[" << s.pop() << "]" << endl;

        // Print the other stack.
        cout << t << endl;
}
<<C++ Integer Stack Implementation PrintMe Class>>