Advertisement

03.28.2003 at 04:51PM PST, ID: 20567036
[x]
Attachment Details

Unary minus in a postfix expression

Asked by larissav in C Programming Language

Tags: unary, infix, postfix, minus

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
[+][-]03.28.2003 at 06:04PM PST, ID: 8228950

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.28.2003 at 06:23PM PST, ID: 8229009

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.28.2003 at 06:23PM PST, ID: 8229010

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.28.2003 at 06:28PM PST, ID: 8229028

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.28.2003 at 06:30PM PST, ID: 8229039

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.28.2003 at 06:31PM PST, ID: 8229045

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C Programming Language
Tags: unary, infix, postfix, minus
Sign Up Now!
Solution Provided By: akshayxx
Participating Experts: 1
Solution Grade: A
 
 
[+][-]03.28.2003 at 06:47PM PST, ID: 8229094

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32