If you have to implement a stack backwards, ok.  :)  It's a common thought pattern; i used to do it all the time too.  But the truth is, it makes a lot of things easier if you consider the stack to grow upward.

void myStaticIntStack::push( int newElement )
{
    if( storedElements == stackSize ) {
        cout &lt;&lt; "Stack is full, you must POP an element before PUSHing a new one!" &lt;&lt; endl;
    }
    else {
        // note the lack of index math :P
        elements[ storedElements ] = newElement;
        storedElements++;

        // you could even do this all in one line like:
        //  elements[storedElements++] = newElement;
        // but i assume you're just learning c++, so.  :)
    }
}

int myStaticIntStack::pop()
{
    if( storedElements == 0 )
    {
        // For future reference, you should be throwing exceptions here, rather than
        // returning an int.  You're forgiven this time, cause you're new.  :)
        // But what if i wanted to store -1 in this thing?  I can't reliably do that,
        // now that you've used -1 as an error code.

        cout &lt;&lt; "Stack is empty, you must PUSH an element before POPping one!" &lt;&lt; endl;
        return -1;
    }
    else
    {
        storedElements--;
        // again, note the indexing is much simpler
        return elements[storedElements];

        // You could likewise make this a one-liner...
        //  return elements[--storedElements];
    }
}


Simple static integer stack
What's the difference between bash reserved words and built-in commands?

Can I disable bash's time, and use /usr/bin/time? If not, how can I format its output?
