//Here is the code when I run it operands are displayed but all operators are garbage data. Can you please help me figure it out.
if (isOperator(expression[i]) == 0)
{
while (((isEmpty() != -1) && (priority(expression[i]) <= priority(stack[getTop()]))))
{
exp[j++] = expression[i];
}
push(expression[i]);
}
while 检查堆栈是否为空以及运算符的优先级是否小于或等于预先存在的运算符之一。IsOperator 检查扫描的字符是否为运算符并返回 0 或 1 i 是遍历整个字符串的 for 循环的计数器。也是输入表达式的索引。j 是输出表达式的索引
例如当我输入:a+bc d 预期输出:ab+cd - 实际输出:abcd?