I have an assignment where I have to create a calculator which accepts a string containing a POSTFIX equation.
My program compiles and executes, but it keeps saying that there is nothing to pop because the stack is empty, which means that there is a problem when I am calling the push function, as perhaps the elements are not getting pushed in.
My stack implementation is basic, aside for these functions:
1 2 3 4 5 6 7 8 9 10
void Stack::growStack(int newCapacity)
{
double *x = newdouble[newCapacity];
for (int i = 0; i < capacity; i++)
{
x[i] = s[i];
}
delete[] s;
s = x;
}
This only gets called in my push function if isFull() returns true
Have you stepped through with a debugger? This would tell you exactly where the issue is happening. I highly recommend you spend an hour familiarizing yourself with your debugger, as that is an incredibly valuable skill.
I can't be of much help without seeing your Stack code.