Problem # 14 : Expression Evalutaion

Write a function CALC(A$) which takes a mathematical expression and calculates it.
The expression will be given as a string A$. For example A$="(10-5*(7+3))"

Sample Output
CALC("10-5*(7+3)") should return : -40
CALC("15.5-9.8*(2.3+3.7)-56/2+4") should return : -67.3
CALC("17.5+4.3*(2.4+5.33)") should return : 50.739

HINT : Convert the expression into post-fix form and then calculate it.
This will amount to creating a reverse polish notation calculator.


Previous Problem
Return to problems at The Vault
(Back to problems at The Vault )
Next Problem

LinkExchange
LinkExchange Member
1