nims11
BIOS Terminator
here is what i want to achieve using C++
1.the user inputs a mathematical expression(like 3^2 + sin(1))
2.my program displays the result.
this seems simple but is actually very complex as C++ doesnt have any feature like the eval() function in javascript.
after thinking a lot and coding, here is what i achieved -:
1. the user inputs the mathematical function in postfix form with each element separated with a space.
eg. 3^2 + sin(1) is written as 3 2 ^ 1 sin +
2. the program simulates a virtual stack and evaluate the result.
the Drawback-
1. user has to convert every mathematical to postfix form.
2. its a bit slow(noticeable in consecutive executions).
Please suggest how to process an infix(normal) expression and what you would have done to achieve it...
1.the user inputs a mathematical expression(like 3^2 + sin(1))
2.my program displays the result.
this seems simple but is actually very complex as C++ doesnt have any feature like the eval() function in javascript.
after thinking a lot and coding, here is what i achieved -:
1. the user inputs the mathematical function in postfix form with each element separated with a space.
eg. 3^2 + sin(1) is written as 3 2 ^ 1 sin +
2. the program simulates a virtual stack and evaluate the result.
the Drawback-
1. user has to convert every mathematical to postfix form.
2. its a bit slow(noticeable in consecutive executions).
Please suggest how to process an infix(normal) expression and what you would have done to achieve it...