Comparing operators

I am trying to compare a math operator with a variable, but i keep getting this error: postfixDriver.cpp:93: error: expected primary-expression before ')' token.

I'm sure it's probably something simple, but im just not seeing it. Here is the code snippet:

while (strlen(str) != 0) {

split (str, token);
Postfix stack;
double a;
double b;
double answer;

if (atof(token)==0.0)
{
a = stack.pop();
b = stack.pop();
}

if (token == +) <----Error
{
answer = b + a;
stack.push(answer);
}
else if (token == -)
{
answer = b - a;
stack.push(answer);
}
else if (token == *)
{
answer = b * a;
stack.push(answer);
}
else if (token == /)
{
answer = b / a;
stack.push(answer);
}
else if (token == $)
answer = pow (b,a);

Any help would be greatly appreciated!
Please use code tags when posting code.

Is token supposed to be a character? If so, then you need to surround the character literals you're comparing it to in single-quotes, e.g.

if (token == '+')
Thank you!
Topic archived. No new replies allowed.