Refer to InFix to PostFix and PostFix expression evaluation. written by me which I think would help you solve your problem