This question is about improving my C++ coding skills. I was asked to implement a simple static integer stack in C++ as an assignment. I've come up with the following code:

class myStaticIntStack
{

    int stackSize;
    int storedElements;
    int *elements;

public:

    myStaticIntStack();
    myStaticIntStack( int aNumber );

    ~myStaticIntStack();

    int peek();

    int pop();

    void push( int element );

};

myStaticIntStack::myStaticIntStack()
{
    this-&gt;stackSize = 1;
    this-&gt;elements = new int(0);
    this-&gt;storedElements = 0;
}

myStaticIntStack::myStaticIntStack( int stackSize )
{
    this-&gt;stackSize = stackSize;
    this-&gt;elements = new int[ stackSize ];
    this-&gt;storedElements = 0;
}

myStaticIntStack::~myStaticIntStack()
{
    if( this-&gt;elements != NULL )
    {
        if( stackSize &gt; 1 )
            delete[] this-&gt;elements;
        else
            delete this-&gt;elements;
    }

}

void myStaticIntStack::push( int newElement )
{
    if( this-&gt;storedElements == this-&gt;stackSize )
        cout &lt;&lt; "Stack is full, you must POP an element before PUSHing a new one!" &lt;&lt; endl;
    else
    {
        this-&gt;elements[ (this-&gt;stackSize - 1) - this-&gt;storedElements ] = newElement;
        this-&gt;storedElements++;
    }
}

int myStaticIntStack::pop()
{
    if( this-&gt;storedElements == 0 )
    {
        cout &lt;&lt; "Stack is empty, you must PUSH an element before POPping one!" &lt;&lt; endl;
        return -1;
    }
    else
    {
        storedElements--;
        return this-&gt;elements[ (this-&gt;stackSize - 1) - this-&gt;storedElements ];
    }
}

int myStaticIntStack::peek()
{
    if( this-&gt;storedElements == 0 )
    {
        cout &lt;&lt; "Stack is empty, you must PUSH an element before PEEKing one!" &lt;&lt; endl;
        return -1;
    }
    else
    {
        return this-&gt;elements[ this-&gt;stackSize - this-&gt;storedElements ];
    }
}

int main()
{
    myStaticIntStack aStack(3);

    cout &lt;&lt; "Popped Element: " &lt;&lt; aStack.pop() &lt;&lt; endl;

    aStack.push(1);
    cout &lt;&lt; "Stack Top is: " &lt;&lt; aStack.peek() &lt;&lt; endl;
    aStack.push(2);
    cout &lt;&lt; "Stack Top is: " &lt;&lt; aStack.peek() &lt;&lt; endl;
    aStack.push(3);
    cout &lt;&lt; "Stack Top is: " &lt;&lt; aStack.peek() &lt;&lt; endl;
    aStack.push(4);
    cout &lt;&lt; "Stack Top is: " &lt;&lt; aStack.peek() &lt;&lt; endl;

    cout &lt;&lt; "Popped Element: " &lt;&lt; aStack.pop() &lt;&lt; endl;
    cout &lt;&lt; "Stack Top is: " &lt;&lt; aStack.peek() &lt;&lt; endl;
    cout &lt;&lt; "Popped Element: " &lt;&lt; aStack.pop() &lt;&lt; endl;
    cout &lt;&lt; "Stack Top is: " &lt;&lt; aStack.peek() &lt;&lt; endl;
    cout &lt;&lt; "Popped Element: " &lt;&lt; aStack.pop() &lt;&lt; endl;
    cout &lt;&lt; "Stack Top is: " &lt;&lt; aStack.peek() &lt;&lt; endl;

    return 0;
}


The code is compiling and running correctly, this is standard output:

Stack is empty, you must PUSH an element before POPping one! 
Popped Element: -1 
Stack Top is: 1 
Stack Top is: 2 
Stack Top is: 3 
Stack is full, you must POP an element before PUSHing a new one! 
Stack Top is: 3 
Popped Element: 3 
Stack Top is: 2 
Popped Element: 2 
Stack Top is: 1 
Popped Element: 1 
Stack is empty, you must PUSH an element before PEEKing one! 
Stack Top is: -1


However I was given a B due to the following reasons:


There was a better way of implementing it. 
I didn't manage well the case in which I'm trying to POP an element from an empty stack, since it's confusing that pop() returns a value even if Stack is empty.


Can you please help me understand how I could improve my code?


Question: Is it possible to create your own server on the Xbox 360?
Answer: No. There is nothing in place (unless I've missed it) to host a game of BF3 on your own server. This is for the best as hosting one's own server opens up the potential for great abuse.