Could you please be a bit more specific as to "crashing"?
When does the program crash, immediately or after a certain action?
Do you get any error messages?
The more specific you are, the better we'll be able to help you.
I don't really know anything about std::stack but looking at the first lines of your code shows some error:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
int postfixEval(string s)
{
int ch, ....
char op;
for ( int count = 0; count < s.size(); count++ ) {
ch = s[count]; // your trying to assign a char to an int
//...
if ( ... ) {
}
else {
ch = op; // ch is an int, assigned to the undefined value of op, i think you mean the inverse of this
switch ( op ) { ... }
}
}
}
and what if s[0] ... is neither an operand or operator ? what should the program do ?