Converting Chars to Ints, then arithmatic...
In this program I'm supossed to recieve an infix expression from a user. Then convert it into a postfix expression and finally evaluate the postfix expression.
This is a program using Stacks by the way.
I am stuck trying to evaluate my postfix expression( string). I'm supossed to add operands from the postfix expression to a stack. Once I get to a +, /, *, - char in the postfixExp I have to "pop the top of the stack" twice.
The "pop" method returns the popped chars to the DP.
Now this is where I'm in agony!!!!
I will have to convert the 2 popped CHARS to INTS then perform the app. operation depending on the current operator. Once I get the result of the operation I have to convert it back to a char and add it into the stack..
The CHAR to INT conversion leave the INTs with the Unicode and I dunno what to do now!!!!!
- How do I use the +, -, *, / operations if the INTS are in Unicode?!?!?!?!?!?
I would appriciate it if you would tell me pretty much the code, not pseudocode, cause I know what to do I just don't know how to do it. Also please tell me how to covert the result from an INT back to a CHAR!!
I normally do my own work but I'm annoyed, tired and stressed. This program is due Monday and I have another do Wensday. I wanna get them done by Monday to hand both in on same disk!!!
THANKS FOR YOUR HELP!!
If you haven't already found out:
char c = 'H';
int i = c;
char c2 = (char)i;
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center