-
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:
Code:
char c = 'H';
int i = c;
char c2 = (char)i;
ArchAngel.
O:-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks