I have developed a program that converts infix expressions to postfix and evaluates them, however, I would like to implement a unary minus ~ to represent negative numbers in my expressions. Does anyone know how I could implement this? I have tried thinking of everything, but I do not know how to make it evaluate it as a negative number, as opposed to an operator. I am thinking I will have it take precedence over div,mult,and mod, but be lower than parentheses. I am just lost as to how to convert this, though. Any help would be greatly appreciated! Thanks!!
Start Free Trial