1 2 3 4
|
Stack()
{
//what do I put here ?
}
|
Suppose that you do
Stack foo;
¿how should be the internal state of `foo' after that point?
At least you should initialize your members (`c' is uninitalized, so `i' will hold garbage too).
>> Get the nxt token (const, varaible, arthmetic operator)in the postfix expression.
> What is this mean ?
Read the next character in the input.
Classify it an threat it according.
> if the token is an operand, push it onto the stack. If it is an operator, then do the foloowing:
1 2 3 4 5 6
|
if( is_operand(token) )
stack.push(token);
else if( is_opeator(token) ){
//...
}
else //¿can this happen?
|
1 2
|
if(isdigit(somevalue[i]))
{ i = somevalue.back();
|
`i' is used as an index, but it seems that the container also stores indexes (doubt that, it stores operands)
There is no need to use one variable for everything, you may easily create another. Also, use meaningful names.